How to Change the Category Base Prefix in WordPress

Comments Off on How to Change the Category Base Prefix in WordPress    July 3, 2017 13:00

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. In this article, we will show you how to change the category base prefix in WordPress. We will also talk about whether or not you should remove the base prefix altogether.

How to change the category base prefix in WordPress

What is Category Base Prefix? Should You Change It?

Each category on your WordPress site get its own page and RSS feed. You can view all posts filed under a category by visiting that category archive page.

By default, WordPress adds ‘category’ as 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:

http://example.com/category/news/

Similarly, WordPress also adds tag prefix to URLs for tag archives.

http://example.com/tag/iphone/

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 category base prefix is quite simple in WordPress.

You need to visit Settings » Permalinks page and scroll down to the ‘Optional’ section.

Changing category base prefix in permalink settings

Here 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.

Don’t forget to click on the save changes button to store your settings.

Setting up Redirects After Changing Category Base Prefix

If you are changing category base prefix on a new 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 setup redirect to make sure both search engines and regular visitors are properly redirected to the correct category page on your site.

First you will need to install and activate the Redirection plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools » Redirection page to setup redirect.

Setting up redirect after changing category prefix

Scroll down to ‘Add new redirection’ section.

First, you need to add /category/(.*) in the source URL field. After that you need to check the box next to the regular expression option.

In the target URL field, you need to add your new category base prefix like this /topics/$1. Don’t forget to replace topics with your new category prefix.

Click on the ‘Add Redirection’ button to save your changes.

That’s all. Now all your users and search engines will be redirected to the correct URLs using your new category prefix.

Removing The Category Base Prefix in WordPress

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:

http://example.com/news/

This is not a good idea, and we recommend that you do not remove category base prefix.

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 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 infinite redirect loop causing the pages to never load.

However, if you still want to do this, then you need to install and activate FV Top Level Categories plugin. For more details, see our step by step guide on how to install a WordPress plugin.

The plugin works out of the box and will immediately remove the category base prefix from your category URLs.

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.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Change the Category Base Prefix in WordPress appeared first on WPBeginner.


  No Comments   Comment