By default, WordPress uses category base in the links. That means your link appears as ‘www.domain.com/category/category-name‘. What if you’d like to remove this category base and have clean and short URL like ‘www.domain.com/category-name‘?
In this tutorial, we’re going to learn how to remove category base from WordPress URLs. I’m going to tell you different ways to do it.
From the permalink settings
This could be the simplest and the easiest way to remove category base as you can do it without touching any code or installing any extra plugins. You can do it easily with following steps:]
Log in to the WordPress Dashboard.
Click on the Settings >> Permalinks menu.
In the optional section, there’s the place to choose the category base. Put dot (‘.’) in the input field for category base.
Click on the Save Changes button.
Category base is now stripped out from the URLs.
Using Yoast SEO plugin
Yoast SEO is one of the most installed WordPress SEO plugins. If you have installed Yoast SEO plugin, there’s another way as well to strip out category base from the URLs.
Log in to the WordPress dashboard.
Click on the SEO >> Advanced menu.
You’ll reach to the Advanced – Yoast SEO page.
Click on the Permalinks tab.
On the Change URLs section, choose to Remove the category base.
Scroll down to the bottom of the page and click on the Save Changes. That’s it!
Using .htaccess file of root directory
This option could be complex for you as you need Cpanel or FTP access to your website. If you have such access, add following code to the .htaccess file in the root directory of WordPress installation.
RewriteRule ^category/(.+)$ http://www.site.com/$1 [R=301,L]
Using FV Top Level Categories Plugin
You can do this task by installing FV Top Level Categories plugin as well.
Click on the Plugins >> Add New menu.
Search for the FV Top Level Categories plugin and install it.
This plugin does it work immediately after activating it.
I’ve presented here 4 different ways to strip out category base from the URLs. I personally recommend you to follow the first method or second as they are simple and you can get your work done without touching any line of code or adding the extra burden to WordPress with another plugin.
I hope this tutorial was useful for you. If you’ve any query or suggestions, kindly put them forward from the comment box below. Lots more tutorials and articles are on the way. So, keep tuning WPAll Club!