WordPress .htaccess Redirect Category To Other Category

The Problem

On one WordPress blog I found that the category name is misspelled and had to correct it. The first step was to move all post from the misspelled category to correct category. When you move the post from one category to another category then WorPress automatically does 301 redirects the old url to new url so you don’t need to add any 30 redirection.

However there is no way to redirect the old category to new category. There are 301 redirection plugins but I’m reluctant to add a plugin to just do the category redirection.

So the solution is to add a directive in .htaccess file.

RewriteRule ^oldcategory$ http://www.domain.com/othercategory [L,R=301]

This .htaccess directive will redirect oldcategory (only the category and not all the posts inside this category) to othercategory.

Once you have added the directive in .htaccess, delete the oldcategory.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *