Do you want to change the category base prefix in WordPress?
By default, WordPress automatically adds /category/ as a prefix to URLs for all category pages. However, you can easily change the category base prefix or completely remove it.
In this article, we will show you how to change the category base prefix in WordPress.
What is Category Base Prefix? Should You Change It?
By default, WordPress adds ‘category’ as a base prefix to URLs for category pages. This helps differentiate pages and posts from category and tag archives.
For example, if you have a category called ‘News’ then its URL will look like this:
Similarly, WordPress also adds tag prefixes to URLs for tag archives.
This SEO-friendly URL structure helps users and search engines understand what kind of page they are visiting.
Most websites don’t need to change the base prefix at all. However, if you are creating a niche site where you would like to use a different word or phrase for your categories, then you can change the category base prefix to reflect that.
Changing Category Base Prefix in WordPress
Changing the category base prefix is quite simple in WordPress.
You need to visit the Settings » Permalinks page from your WordPress dashboard and scroll down to the ‘Optional’ section.
In the ‘Category base’ field, you can enter the prefix you would like to use next to the category base option. You can also change the tag base prefix if you want.
For example, you can add ‘topics’ as the new prefix. In this case, your category URLs will look like this:
Don’t forget to click on the ‘Save Changes’ button to store your settings.
Removing Category Base Prefix from URLs
Many of our users have asked us about removing the category base prefix from WordPress URLs altogether. This will change your category URLs to look like this:
This is not a good idea, and we recommend that you do not remove category base prefix.
The category base prefix helps both users and search engines distinguish between posts/pages and categories. Removing the prefix makes your URLs ambiguous, which is not good for user experience or WordPress SEO.
You may also run into technical issues with various WordPress plugins. For example, if you have a category and a page with the same name or when you are using %postname% as your URL structure for single posts, then your site will experience an infinite redirect loop causing the pages to never load.
However, if you still want to do this, then you can use the All in One SEO (AIOSEO) plugin.
It is the best SEO plugin for WordPress and makes it super easy to optimize your website for search engines. Plus, it gives you an option to strip the category base prefix with a click of a button.
For this tutorial, we’ll use the AIOSEO Pro license because it includes the feature to remove category base and other powerful options like the redirection manager and link assistant. There’s also a free version of AIOSEO that you can use.
First, you’ll need to install and activate the AIOSEO plugin. For more details, please see our guide on how to install a WordPress plugin.
Upon activation, you’ll see the AIOSEO setup wizard. Simply click the ‘Let’s Get Started’ button. You can see our guide on how to setup All in One SEO for WordPress for more information.
Next, you can head over to All in One SEO Search » Appearance from your WordPress admin panel and click on the ‘Taxonomies’ tab.
After that, go to the Categories section and switch to the ‘Advanced’ tab. From here, simply click the toggle to Yes for ‘Remove Category Base Prefix’ option.
Don’t forget to click the ‘Save Changes’ button when you’re done.
Setting Up Redirects After Changing Category Base Prefix
If you are changing or removing the category base prefix on a new WordPress website, then you don’t need to do anything. However, if you are doing this on an existing website, then users visiting the old category page will see a 404 error.
To fix this, you will need to set up a redirect to make sure both search engines and regular visitors are properly redirected to the correct category page on your site.
The easiest way of setting up redirection in WordPress is by using the All in One SEO (AIOSEO) plugin.
To start, you can go to All in One SEO » Redirects from the WordPress admin panel and then click the ‘Activate Redirects’ button.
Once it’s active, you can go to the ‘Redirects’ tab to setup redirection.
Simply enter the URL you want to redirect under the ‘Source URL’ field and the new location for the link under the ‘Target URL’ field.
As for the Redirct Type, you can select ‘301 Moved Permanently’ from the dropdown menu. This will permanently move your old category pages to the new destination.
Don’t forget to click the ‘Add Redirect’ button when you’re done.
For more details, please see our beginners guide to creating 301 redirects in WordPress.
Now all your users and search engines will be redirected to the correct URLs using your new category prefix.
We hope this article helped you learn how to change the category base prefix in WordPress. You may also want to see our list of most wanted WordPress tips, tricks, and hacks and how to start an online store.
The post How to Change the Category Base Prefix in WordPress first appeared on WPBeginner.