How to Remove the Category Base From Your WordPress Urls
Here are 4 ways in which you can remove the Category Base from your WordPress Urls. Categories are one of WordPress’s default Taxonomies, a way of grouping content together, Tags are another example.
When bloggers create a lot of content around one subject they often want a section of their site to represent the subject in the search engines. The category Taxonomy does just that. However by default the category url isn’t pretty.
Removing the category slug (prefix) from your WordPress urls not only looks cleaner and more user-friendly, but has SEO benefits as well.
When you create a category, a slug name of your category is generated as well to be displayed in the URL. For example: https://digitalprawn.com/category/seo/. When you remove the /category/ prefix from WordPress permalinks, you would be left with a more SEO friendly url structure e.g. https://digitalprawn.com/seo/.
There are a number of ways to achieve this.
- Navigate to Settings
- Click Permalinks
- Scroll down to Custom Structure
- Add /%category%/%postname%/ as a custom structure, you can copy and paste exactly from the box below.
Your custom structure should now look like this.
- Now scroll down to the Optional section
- Add a . (full stop, period) in the Category Base input box
- Hit Save Changes
Note: If you website is not new, changing your permalinks settings can seriously impact your search engine visibility. Be sure to redirect old URLs to new ones to avoid loses. There are plugins available to help you set up 301 redirects such as Simple 301 Redirects.
Method 2: With Yoast SEO Plugin
If you are already using the popular Yoast SEO plugin for WordPress, you will be please to know they have this feature built in.
Removing Category From Your URLs With Yoast’s SEO Plugin
- Go to Yoast SEO.
- Select advanced.
- Click on the tab permalinks at the top.
- Check Strip the category base (usually /category/) from the category URL.
Method 3: Remove the Category Base With .htaccess
If you are confident editing a .htaccess file, follow the instructions below.
You still need /%category%/%postname%/ as a custom structure as shown in method 1, but you do not need the full stop/period in the Category Base input also shown in method 1.
- Connect to your WordPress site via FTP
- Navigate to .htaccess file in WordPress root
- Open the .htaccess file
- Add the following code before the closing </IfModule> tag.
- Re-upload the edited file via FTP.
RewriteRule ^category/(.+)$ http://www.website.co.uk/$1 [R=301,L]
Note: Change the domain in the above example for it work for your site
Method 4: Remove the Category Base With Plugin
This standalone Remove Category URL plugin will completely remove the ‘/category/’ from your permalinks.
Simply install and activate, no configuration or modification of WordPress files is required.
Another great feature is by default it redirects old category permalinks to the new ones which is great for SEO.
Thanks for reading and I hope these examples offer you a solution.