WordPress Tutorial: Changing Category Url’s

As a website and blog grows often the site structure will change, the sitemap will need to evolve to fit your new needs and wants. One of the biggest things that you may consider changing is the category url (also called the category slug). This post is a quick and easy guide to making these changes if you are using WordPress, though this explanation attempts to cover all sites.
This is the same process to use when changing a blog post or page url on a website.

Note: I am making the assumption that you have considered how this may or may not affect the search ranking of your website and blog. If you have any questions about how changing a category url can effect your SEO tweet me @andykinsey or leave a comment below.

Step 1 – Planning Your URL Change

Before jumping into the change of url you need to consider what is the best new url for your category. Remember you don’t have to replace categories one for one, you can consolidate removing one category and point everything to another.

If you are consolidating life is a little easier for you-  move to the next step.

If you are changing urls, you need to ask why you are changing it and whether the new url will last a long time – if it is not going to last and you will need to change again shortly I advise you reconsider. Your categories should be long lasting and not transient.

Also during this phase install the wordpress plugin “redirection” – otherwise you will need to edit your .htaccess file (this is the file other platform users will need to edit).

Finally, you should organise a backup of your blog – the simplest to do this ask your web host or developer, though there are plugins which will also do this.

Step 2 – Change Your Category URL / Slug

Now for the first “technical” step – only its very very easy.

Go to Posts > Categories and click Quick Edit under the category you wish to modify.

Tip: copy the old Slug into a notepad, you will need it later.

Now change your slug to the new slug, remember any spaces should be hyphen’s (-) or underscores (_). Then click Update Category.

Note: the word slug is actually the URL of that category.

Step 3 – Setting Up Your Redirect (Using “Redirection” Plugin)

Another technical step – still fairly easy.

Go to Tools > Redirection and look for the box below.

This box is your key to success, be careful as a mistake here can cause havoc later. (you’ve been warned)

Source URL refers to the original url or slug. For example /re-design/ (which was an old category on SEOAndy) so we enter this into the box ensuring the two slashes are in place and we add (.*) to the end. This last section is part of a regular expression (formula if you will) which in this case catches anything in the category we list.

As mentioned above we are using regular expressions, so Click the tick box.

Now we want to tell the plugin what we are changing the URL / Slug to. So in Target URL enter your domain name including the http://www and end it with your new category name with a slash and dollar one $1 … ok confused. Heres a quick example:


$1 tells the plugin that you want anything you’ve caught with (.*) to go here. so for example /re-design/cats would now go to https://andykinsey.com/content-strategy/cats – no that doesn’t exist really.

The finished box should look something like this.

Looking good? Hit Add Redirection – and you are done!

You can now test the redirect and grab a brew – well done scout!

Step 3 – Setting Up Your Redirect (.htaccess)

Very Techy, probably best leave this to a developer or SEO.

The .htaccess file is very powerful, as it is a configuration file for wordpress and other content platforms. Event the smallest of errors in the .htaccess file can result in website errors and in some cases the website not displaying at all.

WARNING! Always, Always, Always take a backup copy of the .htaccess file before you edit the file, do this EVERY time you edit the file. If you make a mistake and have no backup you will struggle to right your wrongs without expert help. Keeping a backup means you can fall back quickly and easily. [/box]

Assuming you’ve read the above, lets build on your knowledge. In the .htaccess file you want to create a redirect, in this case it would be a permanent move (a 301 redirect) and not temporary (a 302 redirect). So lets begin – scroll to the bottom of your .htaccess file.

Type in the below to achieve the same redirect as above

Redirect 301 /re-design/(.*) https://andykinsey.com/content-strategy/$1

As you can see it’s pretty much the same syntax.

Re-Step – Redirecting a Page or Post in WordPress

The above steps are fairly simple, even though they use regular expressions. If you are redirecting a specific page it is even easier.

In the plugin, the source url becomes the old page slug (you must include everything after the .com or .co.uk), for example /re-design/blog-name-title-thingy and the target you would simply change that to the new url (remember to include the domain name), for example https://andykinsey.com/content-strategy/blog-name-title-thingy

And in .htaccess – we’ll you’ve guessed it simply swap out the various sections described above.

The Last Word in WordPress Redirection

Redirecting a wordpress category or blog post is simple using the technique above. It’s quite low risk in terms of technical errors and it will protect your search rankings as much as is possible with a redirect.

My top tip is to back up your website before making any changes to urls of any kind – having picked up the pieces many times I can tell you now it isn’t pretty or easy to do.

Finally, I know the post above is daunting – if you have any questions about redirecting your category or blog post or web page please do leave a comment below. Other lovely readers or myself will be along shortly to help you.