WordPress is a popular CMS tool which is used by millions of webmasters for building their sites. But you should tweak it a little to get better out of WordPress.In this tutorial we will look on tweaking one such aspect ie; removing /category/ from WordPress category URL.
By default WordPress adds /category/ to your WordPress category url’s.But they are of no use (SEO aspect) & doesn’t look nice.
This is how WordPress shows category archives url’s :
There are two methods by which you can strip /category/ from your WordPress category URL’s. Lets see them :
Method : 1
If you want to remove /category/ from the url, follow these two steps:
- Navigate to Settings -> Permalinks and select Custom Structure and enter: /%category%/%postname%.html
- Now under Optional settings set Category base to /.
That’s it ! Now click on Save and you’ll see your URL changed to the below format:
Method : 2
In this method we will use the .htaccess file.However if you have subcategories, then this tip doesn’t work.
First take backup of your .htaccess file. Now download it to your computer.
- Add the below line of code to the end of your .htaccess file using your favorite text editor & save it.
RewriteRule ^category/(.+)$ http://www.yourblogname.com/$1 [R=301,L]
- Now re-upload the .htaccess file back to the normal location, replacing the existing one.That’s it ! you have learnt another way of stripping category base from your WordPress Url’s.
If you don’t want to mess with the files or some thing like that, then you can use plugins like WP No Category Base or Yoast SEO Plugin or some other plugin which does the same thing. But I don’t recommend that as adding extra plugins for simple tasks like this will increase the blog loading time.
If you find this tutorial helpful, please consider sharing it with your friends!