WordPress is capable of automatically adding /category/ as a prefix to URLs for every category pages, by default. Here, you will learn how to change the category base prefix in WordPress.
Understanding Category Base Prefix – Is It Necessary to Change It?
Did you know all categories on the WordPress site acquire its own RSS feed and page? This means you simply require visiting the archive page of a category to view all posts filed under that specific category.
By default, WordPress adds ‘category’ as a base prefix to URLs for category pages. This helps differentiate posts and pages from tag archives and category. For instance, if your post or page has a category named ‘Health’ then URL for that category will look like the following:
In the same way, tag prefix is added by WordPress for tag archives to URLs.
This URL structure is categorized as is SEO friendly. It helps search engines and users understand the type of page they visit. Many websites do not require changing the base prefix at all. On the other hand, if you want to create a niche site for using a different phrase or word for your categories, you may change the category base prefix for reflecting the same.
Change Category Base Prefix in WordPress
This is very simple in WordPress. Here’s what you need to do:
Step 1: Visit Settings » Permalinks page.
Step 2: Now scroll down to the ‘Optional’ section.
Step 3: To change the category base prefix in permalink settings, enter the prefix you wish to use right adjacent to the category base option. If you wish, change the tag base prefix.
Step 4: Store your setting by clicking on the button ‘save changes’.
How to Set Up Redirects Post Change of Category Base Prefix
If it is a new website where you wish to change the category base prefix, then there’s absolutely nothing you need to do. On the other hand, if it is to be done on an existing website, your users will see a 404 error.
You can fix this issue by setting up a redirect. This is to ensure regular visitors as well as search engines are appropriately redirected to the right category page on your website. Here’s what you should do in this respect:
Step 1: Install and activate the Redirection plugin.
Step 2: Once the activation is done successfully, visit Tools » Redirection page for setting up a redirect.
Step 3: Scroll down to ‘Add new redirection’ section.
Step 4: Add /category/(.*) in the source URL field.
Step 5: Check the box beside the regular expression option.
Step 6: Add your new category base prefix like ‘/topics/$1’ in the target URL field. You must replace topics with the new category prefix.
Step 7: Now click on the button labeled as ‘Add Redirection’ to save your changes.
Congratulations! Your users and search engines will now be redirected to the correct URLs with the help of new category prefix.
How to Remove Category Base Prefix in WordPress
This process will change category URLs to something as stated below:
However, most WordPress maintenance service and support experts do not recommend this. You should not attempt to remove category base prefix. The category base prefix is very helpful for users and search engines to make a distinction between posts/pages and categories. When you remove the prefix, your URLs become confusing which is definitely not good for SEO and user experience. Additionally, you may also run into technical issues with WordPress plugins.
Hope this post has helped you learn an easy way to change the category base prefix in WordPress!