Remove “Category” From WordPress URL’s with WP No Category Base – Plugin Review

Well-formed URL’s are important to usability and SEO.

WordPress permalinks give us awesome control over the structure of our base URL’s. Combined with well written headlines, we can create catchy, easy to remember, user friendly URL’s across our site.

However, the base install of WordPress will add the word “category” to your url structure before the actual category name. Having “category” in the middle of your URL is not particularly useful, certainly not pretty and can make URL’s longer and harder to remember.

For example, if you have a category on your site called “Gadgets” you would want the URL to look like this:

https://yoursite.com/gadgets.

The url is so intuitive that someone could just type it in and find what they are looking for.

Unfortunately, without some modification your URL will look like this:

httsp://yoursite.com/category/gadgets (no-so-intuitive).

The disadvantages of leaving /category/ in are that it is longer and harder to remember and, according to some sources, the deeper keywords are in the URL the less relevant they are from an SEO standpoint. And you do use well thought out keywords for your category names don’t you?

Keep in mind that URL’s are an important part of SEO, though in the big picture they are only one piece of a much larger puzzle. In other words, URL’s alone won’t give you a ton of SEO juice, but they can help, so don’t ignore them either.

In my opinion, usability is the most important issue and the real reason for well-formed URL’s.

ESPN is a good example, if I want to know about football, I know I can go to https://espn.com/nfl and get football info. I don’t even have to guess if that’ll get me where I want to be.

There are a couple of ways to get rid of the “/category/” in your WordPress URL’s:

  1. Add some code to your .htaccess file (not-recommended)
  2. Use a plugin.

Sidebar: .htaccess files allow you to make web server configurations on a per directory basis and allows for decentralized web server configuration, including things like URL rewriting.

Having been a coder, I’m not at all afraid to modify .htaccess but for most I wouldn’t recommend it. Getting it wrong can cause you some serious headache. In this case, a WordPress plugin works extremely well and is headache free.

For the last couple of years I’ve been using “WP No Category Base.” It works flawlessly, is kept up to date and does exactly what we need: it removes “/category/” from our category-based URL’s and nothing more.

Just download-install-activate and you’re done.

Additional thought: I don’t particularly care for dates in URL’s either, I see them a lot but I’m not inclined to click on yoursite.com/2010/03/ it just doesn’t have meaning.

Download WP No Category Base and get started cleaning up your URL’s!

What permalink structure works well for your WordPress site?

Added notes (1/12/2011): Got a tweet from Bill Erickson regarding performance issues with this plugin. I personally have not experienced any performance issues but Bill has, including one site whose page load time increased 100x when the plugin was deactivated. If you use this plugin and experience any latency, as a result, deactivate it and see if the problem goes away, then come back here and let me know! As Bill has said, page load time is far more important than one word in a URL. Again, no issues in my usage but keep an eye on it and as with all things WordPress, if you start to have any problems, plugins are the first thing to check.

Bill is a very knowledgable WordPress developer so I’d look him up if you’re in the market for one. You can find him at https://billerickson.com or on twitter @billerickson.

31 Comments

  1. Bill Erickson on January 12, 2011 at 7:41 pm

    Thanks for adding the note. Here’s what I couldn’t fit in 140 characters 🙂

    Here’s a technical description of the issue ( http://ottopress.com/2010/category-in-permalinks-considered-harmful/ ).

    WordPress has rewrite rules, which is uses to determine what content to show on a specified URL. When you remove the category base, or you use a changing base for single posts (ex: /%category%/%postname%/ ) then it needs to make an exception for category archive, page and post that doesn’t fall in the rewrite rules. This might not be noticeable on most sites, but once you have about 50 pages or posts you’ll start to see a difference.

    The client I mentioned was an extreme case. BeatTheGmat.com has thousands of posts, and when they ran the plugin it would take up to 2 seconds for a page to load (and they have a great server setup, and host everything on a CDN). Once we turned off the plugin we saw page load times drop to .02 seconds.

    But again, for the standard website you probably won’t notice a difference. Even I break this rule because I have my posts at billerickson.net/%postname%/ But just know that as you get more content in your site it could affect load time.

    • Bill Erickson on January 12, 2011 at 7:44 pm
    • Scott Ellis on January 12, 2011 at 8:23 pm

      Bill, Thanks for the comments. I’ve read Otto’s post a couple times (slowly) and understand the issue. It’s definitely a notable situation, though I’ve got more than 50 pages and still not a problem but that’s another discussion.

      I’m still interested in usability (and having /category in there just doesn’t fit). So it seems for me (and all of the other type-a site owners out there) that there has to be a core change to the way WordPress works (not likely anytime soon) or another-as to be determined solution.

      I also wonder if most of the effect on performance is negated by an appropriate caching strategy, other than for the first person to hit the page (I was clearing the cache for my test BTW).

      The other concern is for sites that have long used one method or another to remove /category/, but would like to remove their old “fix” if it is causing a performance issue, yet have a lot of links established and don’t want to change the url’s for those links.

      Do you know of an established redirection strategy, particularly for a large site? I’ll have to think about that one.

      • Bill Erickson on January 13, 2011 at 8:19 am

        I’m pretty sure (but not 100%, you’ll need to check with Mark Jaquith) that WordPress automatically sets up 301 redirects for your last URL structure. But I don’t know if this works with the No Category Base plugin or not because you aren’t changing the URL structure in core, you’re disabling a plugin that does it.

        If you change from /%year%/%month%/%postname/ to /%year%/%postname%/ WordPress will automatically set up 301 redirects for that change. If you change it yet again to /blog/%postname it will remove the first 301 redirects and set up new ones for the last change. It only does one change back.

        I completely agree that WordPress needs some work on its URL structures. That is one of the two major improvements I want in WordPress but isn’t currently in the roadmap (the other being a post_relationships table for this: http://www.billerickson.net/wordpress-post-type-linking/ ).

  2. Scott Ellis on February 3, 2011 at 8:59 am

    Just wanted to pitch in some more good reading on the subject of the performance effects of permalink structure. Make sure you read the comments too..

    After reading a few articles and hearing the responses I’m sticking with my /%category%/%postname% structure.

    The technical implications are real but :

    1) Have not caused me an issue (if it does I’ll reconsider)

    2) I don’t believe throwing out usability and SEO to any degree to compensate for a technical problem (especially when there are solutions like caching, use of CDN’s, and more hardware that are individually effective at reducing/eliminating the concern (though not the problem itself) and collectively all but nuke it. (We need to fix the problem in WP, not muck up our sites b/c of a limitation IMHO).

    Just my added $.02 for anyone that reads this in the future, I wouldn’t change your permalink structure. However, if you aren’t using a caching plugin (I use W3 Total Cache) at the very least you should.

    I’d also recommend the use of robust hosting if you get any degree of traffic (or want to drive more) and a CDN. VSEllis.com runs on WPEngine which includes solid hosting, CDN and W3 Total Cache as a part of the package.

    You can also individually set those up (W3TC is a free plugin, choose a good host and at the very least use Amazon S3 as a CDN).

  3. Paul Newcomb on February 7, 2011 at 12:57 pm

    I don’t know if this will screw up my site, but I found a way to get rid of the category base by editing the wp-includes/rewrite.php file.

    In wordpress 3.0.4 it’s line 1031:
    $this->category_structure = trailingslashit( $this->front . ‘category’ );
    changed it to:
    $this->category_structure = trailingslashit( $this->front . ” );

    and it seems to work like a charm, everything’s going smoothly as far as I can tell. Do I have any reason to worry about problems arising because of this? It seems too simple lol.

    • Scott Ellis on February 7, 2011 at 1:25 pm

      Paul,

      The only thing I’ll say is that it’s never advised to change core code.

      1) As soon as you upgrade that change will be overwritten so you’ll have to re-do it with every upgrade
      2) Core code changes can introduce other unexpected consequences
      3) If the core code ever changes your modification will break which could have unexpected consequences…

      A plugin is a much safer long term approach to any WP modification you want to make.

      • Paul Newcomb on February 7, 2011 at 2:14 pm

        That’s a good point, I’ll try out the plugin. I’m just weary of it slowing down my site. It doesn’t have a massive amount of pages, but will eventually.

        • Scott Ellis on February 7, 2011 at 2:33 pm

          Paul, Understood and that is a valid concern. There are several things you can do to offset that, the most significant one is to use a caching plugin for your site. I highly recommend W3 Total Cache (for anyone, whether you have the category issue or not).

          Caching will significantly speed up your site and take load off your server.

          You can also make sure you’re on some solid hosting. If you’re sitting on a box with thousands of other sites (which is pretty standard) you’ll never be fully optimized for speed.

          Of course there are a lot of other “optimization” things you can do but those two alone will take you pretty far.

          See the video on website hosting types if you want to learn more about that.

  4. aljuk on February 14, 2011 at 10:23 am

    If you happen to be using this custom permalink structure: /%category%/%postname%/
    – simply setting your Category Base field to ‘.’ (without the quotes) will remove /category/ from the permalink.

    I’m no expect with regard to WP addressing internals, but might this negate the performance hit you’re discussing?

    • Scott Ellis on February 14, 2011 at 10:43 am

      Interesting… Sometimes the simplest solution is the best but I’ll leave it to the code experts to determine if this approach negates the performance issue or if it gives rise to any others …

    • Paul Newcomb on February 14, 2011 at 11:00 am

      worked great for me!

    • iDope on March 8, 2011 at 1:13 pm

      The period workaround does work but that adds a period to all your URLs kinda defeating the purpose.
      You just don’t see the period when you mouseover the link as the browser automatically normalizes the link (’./’ is treated as the same directory on most file systems, i.e. ‘/’). If you view the source of the page the periods in the links will be visible (and they will be visible to search engine bots as well).

  5. aljuk on February 14, 2011 at 10:25 am

    Oops, I’m no ‘expect’ at proofreading either… 🙂

  6. Nelson Pires on February 24, 2011 at 11:19 pm

    There’s 2 issues here, first using the .htaccess rules will generate a 301 redirect for each request, not optimal at all, secondly all plugins have issues with a custom permalink structure like /%category%/%postname%/. I have just blogged about this here (http://www.nelsonpires.com/wordpress/remove-word-category-from-wordpress-urls/) and there’s only one real solution — change the WordPress code.

    • iDope on March 8, 2011 at 2:17 pm

      I am yet to come across a plugin that has issues with a /%category%/%postname%/ permalink structure.
      Try the No Category Base plugin. It works in a way that is optimized as well as compatible (using WordPress’ own rewrite engine) and certainly beats having to modify WP code.

      • Nelson Pires on March 17, 2011 at 5:25 pm

        Hey iDope, thanks for the tip. I just managed to find time to test this and the plugin works great. I tried all the plugins I could find to remove the /category/ word and all failed, maybe because of my setup (Windows with PHP and ionics isapi for pretty urls) but your plugin works a treat, so no more changing WordPress system files. I am now going to edit the blog post (http://www.nelsonpires.com/wordpress/remove-word-category-from-wordpress-urls/) to reflect the new find. Thanks once again.

  7. iDope on March 8, 2011 at 1:33 pm

    I am the author of this plugin and would like to make to some clarifications regarding the issues raised by Bill Erickson.

    First, the plugin does not affect post permalinks so if you set your post permalinks to /%category%/%postname%/ if does not make any difference weather you the plugin enabled or not. Also, the number of posts in your blog makes no difference in performance (as far as url routing is concerned); the plugin doesn’t make those queries faster or slower (weather you have 10 posts or 10 thousand, same number of rewrite rules will be executed).

    Secondly, the plugin does not create an exception for category archives, by letting them fall to a “catch-all” rewrite rules (I am assuming this is what Bill was pointing to when he said “it needs to make an exception for category archive, page and post that doesn’t fall in the rewrite rules”). It creates 1 rule for each category so that categories can be resolved *without* a db lookup. This works fine as long as you have a dozen or so categories which is probably true for 99% of the blogs. Only when you run into hundreds or more categories the performance degradation will be noticeable (which could be the case with BeatTheGmat.com, they seem to have tons of categories, using them like tags, around a dozen categories per post).

  8. Mudassar on December 29, 2011 at 7:39 am

    Hi,
    I just removed “WP No Category Base” and i think everything is upside down. No URL is working now. I don’t want my site to get dependent on a single plugin. Is there a way to deal with it?

    • Scott Ellis on December 29, 2011 at 11:52 am

      Mudassar – We don’t provide technical support here (part of what we get paid to do). Without looking at the site there is no telling what is wrong, typically deactivating that plugin won’t cause your site to break but you might need to redirect some URL’s, particularly if you have any static urls coded.

      The alternative is to write your own rewrite rules in htaccess so no plugin is required but you need to be sure you know what you’re doing if you go that path.

  9. sam on July 21, 2012 at 3:26 am

    Hi,
    nice discussion, got one question, regarding the remove of the word category, does it work with products type pages? we have different categories and products within each category, my question in WP can we get http://www.siteName.com/categoryName/ProductName ?

  10. J Ramirez on April 30, 2013 at 2:28 pm

    I was researching this problem, and I didn’t want my site load to increase by using the plugin you recommended, and through further research I found that You can also use the Yoast SEO plugin (which I already had installed!). Just go to the permalink settings and find the “Strip the category base (usually /category/) from the category URL” option, and check the box.

    • Scott Ellis on April 30, 2013 at 3:01 pm

      The Yoast plugin works great, but not everyone will need all of the other stuff that comes with it. While it was widely reported that you could have issues using the wp-no-category base plugin, the issues were primarily with sites with a significant number of pages. Further, most of the potential effects were easily offset by caching. The issue has been largely resolved in WordPress 3.3. so there is even less concern now. But for anyone still using that plugin there is really no need to worry about site performance. I’ve been using it for years and never had so much as a single blip.

  11. Jane on September 21, 2013 at 5:31 am

    Firstly, Yoast plugin works well for all WP versions. But for those who don’t want to use Yoast plugin, they still can install “WP No Category Base” on all current wordpress versions including WP 3.6.1. It is tested on many websites and works great without any problem.

  12. Bhumi on February 11, 2015 at 5:06 am

    Thanks! It Worked!

  13. Mohsin Ali on November 17, 2015 at 5:36 am

    Good article. I solve my URL issue with your guide. Thanks. But keep it up and share informative stuff .

  14. Robert on December 14, 2015 at 1:20 pm

    Great Post and helpful comments. Hoping to catch iDope’s attention here again… looks to me like your plugin is the only solution to removing /category from our urls … can you please do this for WooCommerce too? … please check the support request I just posted on your plugin here: https://wordpress.org/support/topic/please-update-your-plugin-so-it-effectively-removes-the-category-slug-from-wooco

    Others should help contribute to this plugin too – at least visit the plugin page and rate it and verify that it keeps working on new WP releases.

    THANK YOU!

  15. Rinto Ukken George on June 12, 2017 at 1:43 am

    Why don’t you try the simplest way? I believe 90% of WordPress users using YOAST SEO module. So Yoast has a built-in feature to strip the category base http://www.tutsplanet.com/remove-category-base-urls-wordpress-1105/

    • Scott Ellis on June 12, 2017 at 8:58 am

      Rinto,

      At the time this post was published that wasn’t the case. But a lot of our posts will be getting updates soon and the Yoast functionality will be a part of that.

  16. sagu on June 15, 2017 at 5:21 am

    Thanks for running a great site. Very informative.

    I used the recommendation you mentioned on how to remove category , it works great!

    But ever since my URL name is changed for category now when i go to http://cloudvedas.com/openstack/feed i am getting “Page not found” error . While the feed is still at http://cloudvedas.com/category/openstack/feed . How can i correct this? This is causing error for google crawler also and showing in my google search console URL error report. As crawler is trying the find the feed at http://cloudvedas.com/openstack/feed .

    • Scott Ellis on October 4, 2017 at 8:01 am

      You may need to rewrite your permalinks. Just go to Settings > Permalinks and click save, that should rewrite them.

Leave a Comment