So you’ve made a typo in your WordPress category.
It’s easy to log in to your WordPress administration site and correct the category name, right?
Yep, but that’s only half the job done; any existing external links to posts in that category will still have the old incorrect category in the URL, and will now return a 404 error, i.e. the links will now be broken.
What you need to do is create a redirect from the old incorrectly spelled URL to the nice new one.
To create this redirect you’ll need to be able to modify your site’s .htaccess file (NB: this only works for Apache web servers).
You’ll find it in the root folder of your site. You can access it via FTP, or through your web host’s administration interface, if you have one.
So, once you’ve got it open, you’ll see some existing rules: you can ignore these.
Look for this section:
<IfModule mod_rewrite.c> RewriteEngine On ... (some other stuff here) </IfModule>
If it doesn’t exist, you’ll need to add it.
<IfModule> tags, append the following line:
Redirect 301 /rwong http://yoursite.com/wrong
…and when you save your .htaccess file, your old incorrect URLs should still work!
Let’s break down each part of this new line:
This is a directive for your web server; it tells it what to do with what comes next.
This is the type of redirect to execute. A ‘301’ is a permanent redirect – this tells Google (and anyone else) that this resource had moved permanently. (Here’s a list of HTTP status codes for your reference.)
This string is the trigger for the redirect, i.e. the incorrectly spelled part of your URL.
…and this is the correct URL to redirect to.
So to wrap it all up, you should have something that looks like this:
<IfModule mod_rewrite.c> RewriteEngine On ... (some other stuff here) Redirect 301 /rwong http://yoursite.com/wrong </IfModule>
I hope you might find this useful.
Please comment if you’ve got something to ask, something to add or if you know of a better way to do this.