On your WordPress site, you may want to change the name of an existing category for your posts. This will affect the urls of all the posts belonging to the category(assuming you use Pretty Permalinks) as follows:

Earlier: www.example.com/category/some-post

Now: www.example.com/new-category/some-post

While your WordPress will now use these new URLs and everything will work, you will lose SEO benefits for the URLs using the older category. All links to the older URLs will now stop working leading to a terrible user experience and will affect your Google ranking. You may not want to lose that either!

There is a simple solution to that. You can easily redirect those no-more-valid urls to your new-category-urls.

 

Here’s how:

  • Go to your root wordpress folder and look for .htaccess file. Incase you don’t find one, create a new .htacess with contents as follows:

[code]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] </IfModule>
# END WordPress
[/code]

Note: this is a very basic htaccess file for wp site with “pretty permalinks”

  • Now you need to tell your wordpress to redirect those old category urls to new category urls. To do that modify the .htaccess file as follows:

[code]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^old-category/([a-z/.]+)$ new-category/$1 [R=301,L] RewriteRule ^/category/old-category /category/new-category [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] </IfModule>

# END WordPress
[/code]

  • Save it, upload to your server and its done!

And that’s how you change WordPress category without losing SEO. Before leaving, we want to caution you about errors. It can happen which is why you need to take backups that can be restored whenever you need.

close

Download Now:
Top 11 Secrets of an Awesome WordPress Backup Plugin

Download the guide now