How to: 301 Redirect /category/ to /newfolder/ WordPress
Step 1:
Htaccess is your friend in this case. You can create 301 form your old category base to the new like so:
1 2 3 |
RewriteEngine on RewriteBase / RewriteRule ^old_dir/(.*) http://www.example.com/new_dir/$1 [R=301,L] |
Change old_dir to category example.com to your domain and new_dir to your custom name.
Step 2:
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.
What is Category Base Prefix? Should You Change It?
Each category on your WordPress site gets its 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 the base prefix to URLs for category pages. This option 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://demo.com/category/news/
Similarly, WordPress also adds tag prefix to URLs for tag archives.
http://demo.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 the category base prefix is quite simple in WordPress.
You need to visit Settings » Permalinks page and scroll down to the ‘Optional’ section.
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 site, then users visiting the old category page will see a 404 error.
To fix this, you will need to set up redirects to make sure both search engines and regular visitors are correctly redirected to the correct category page on your site.