How to Remove Category Prefix From WordPress URL: 3 Methods

remove category prefix from urls

You may be wondering that WordPress allows us to remove category slug from URL? By default, WordPress adds a category base of /category/ to the URLs of all category archive pages.

In SEO, we generally talk about shaping the right slug for your site page. As you may know, a URL slug is the part of a link that comes after the domain extension that indicates the link direction.

A perfect URL slug not only helps the user to understand what your page about but also to improve SEO of the page.

How to Remove Category prefix from URLs

Coming to the point, you can undoubtedly remove or change /category/ slug from your page WordPress URLs.

Can be turned into

You heard it right, you can even change it to something different like you can replace /category/ to /info/ or whatever you wanna replace with.

Can be turned into

If it’s not about SEO or whatever any reasons you want to remove or change *category* slug from URL, you need to follow one method from below 3 methods that suit you best.

1. Remove Category prefix from URLs with Permalink settings

The very first and simple method to remove /category/ base from site URLs is done within the WordPress dashboard. You just need to log in to your WordPress site and head towards Settings > Permalinks.

Next, you have to just put a dot ( . ) in the Category Base field. Once you do that WordPress considers this dot ( . ) to blank space in URLs, so ultimately it gets rid of /category/ slug in URLs.

Also, keep in mind, you can even change /category/ slugs with something else. Just put anything in the Category Base field and it will replace it with default settings. If you leave Category Base blank. the category will be displayed in your WordPress URLs.

You may find an outdated resource on other sites.

Like putting /%category%/%postname%/ in the Custom Structure would help. That’s not gonna work it will just add /uncategorized/ slug in your post URLs:

2. Remove Category from URLs with .htaccess

If you don’t want touch permalink settings, no worry you can do this via .htaccess. To do this, you need to paste one line of code to your .htaccess file

Your .htaccess file starts with a dot because it is a hidden file. So if you don’t see it in your root folder, make sure that your file manager isn’t keeping those files hidden from view.

Once you found it, copy and paste the below code to your .htaccess file and save your changes:

RewriteRule ^category/(.+)$$1 [R=301,L]

Make sure you replace  to your domain name.

Next, upload it on your server’s public_html directory. You can access it using FTP client software or File Manager in your cPanel.

3. Remove Category prefix from URLs with Yoast Plugin.

If you’re using Yoast plugin then this is the easiest & safest method you’ll see. With the help of this plugin, you can remove the category prefix from the URLs instantly without adding or changing any code in core files.

To do this: 

  • From the WordPress dashboard, click or hover on Yoast SEO
  • Click on ‘Search Appearance’
  • Click on the ‘Taxonomies’ tab.

remove category prefix using yoast

  • Toggle the ‘Category URLs’ switch.
  • Set to Remove to remove the categories prefix

Note: Make sure you haven’t made any changes to your Category Base settings in permalinks. It can cause unexpected URL behavior and you may face WordPress error.

Wrapping up:

These are some methods to remove /category/ prefix from your site URLs. Of course, there are might other methods too but those would to complicated and dangerous so keep it simple and safe.

I hope this article answers all questions regarding this topic if you having questions or suggestions on this topic feel free to let us know by leaving a comment in the comment section.

Thanks for Reading

Enjoyed this post? Share it with your networks.

Comments (12)

  1. Santi Navarro
    • Tino
  2. Maxime
    • MariusG
      • Pieter Giraldi
  3. Pacovi tiello
  4. Naveen. M
    • Nares. B
      • Editorial Staff
  5. Murada. b
  6. Marcela
  7. MD. Husss

Leave a Feedback!

This site uses Akismet to reduce spam. Learn how your comment data is processed.