WordPress uses the “category” feature to categorize the web contents on your site based on your own needs. Each of these categories will have their own page and the RSS feed. In this case, you can check the exact category archive page to find the blog posts within that category. By default, WordPress uses the word of “category” to be the base prefix for these archive pages. This practice can differentiate the common posts, pages and the custom post type contents from the category archives easily. For instance, we have a hosting award category that has the URL of https://howshost.com/category/web-hosting-award/. In the common cases, there is no need to change the base prefix of your WordPress categories. However, if you want to create a niche site or you have some special requirements, you can make some changes on the prefix. This time, we have come out a simple tutorial about how to replace and remove category base prefix in WordPress.
Replace Category Base Prefix in WordPress
To replace the category base prefix for your WordPress site, you simply need to enter your website admin panel and click the Settings > Permalinks button. From this settings page, you can move down to the Optional section. This section allows you to enter the custom structure for your categories by adding the custom category base prefix.
Set Up the Redirects
If your website is a totally new one, things can be done via the first step. However, if you already run your site for a while and upload some web contents, you have to set up the redirects to make sure that people and search engines can be redirected to the right category archive pages. Otherwise, the 404 error will happen.
For this, you can make use of the Redirection plugin. Upon the installation, you need to hit the Tools > Redirection button. Now, you can enter the new redirection by providing the source URL and the target URL.
- The source URL needs to be “/category/(.*)”.
- The target URL should be “/prefix/$1”. Note that you should replace the word of “prefix” with your pre-determined custom base prefix.
- Lastly, you need to click the Add Redirection button.
Remove Category Base Prefix in WordPress
If you want to remove the category base prefix directly, you just need to install and activate the FV Top Level plugin. No configurations needed. This plugin can work out of the box to remove the base prefix automatically.
But personally, we do not recommend you to do so. After all, it distinguishes your categories from the posts and pages. Upon the removal, the infinite redirect loop may appear when your category archive page has the same URL as one of your blog posts. This error will prevent your pages from loading properly.