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

3 SHARES

Photo Courtesy Chris Dlugoz, Flickr Creative Commons

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:

http://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:

http://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 http://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 “/caegory/” 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 (free of course) 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 whos 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 http://billerickson.com or on twitter @billerickson.

All Comments

Loading Facebook Comments ...

Comments

  1. says

    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.

    • says

      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.

      • says

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

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

    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.

    • says

      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.

      • says

        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.

        • says

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

    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?

    • says

      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 …

    • says

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

    • says

      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.

  5. says

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

  6. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    <a href=”http://s375.photobucket.com/albums/oo195/lantrix/loadtesting/?action=view&amp;current=Plugin_off.png” target=”_blank”><img src=”http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png” border=”0″ alt=”Photobucket”></a>

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    <a href=”http://s375.photobucket.com/albums/oo195/lantrix/loadtesting/?action=view&amp;current=Plugin_on.png” target=”_blank”><img src=”http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png” border=”0″ alt=”Photobucket”></a>

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  7. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  8. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  9. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  10. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  11. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  12. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  13. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  14. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  15. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  16. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  17. lantrix says

    I was experiencing performance issues on a site (8 seconds to load), and then we added Pear (PECL) APC caching, and it was decent again (0.5 seconds to load). Then I came across this page. I AM using the wp-category-no-base on the site I was having performance issues.

    To test this, I setup a new blank site (WP3.1.3), loaded our default set of plugins, and ran a blitz.io load test rush against it. The site has 0 Posts, 4 Pages, 1 Category.

    The load test is: one to fifteen concurrent users hitting the site over 30 seconds (it’s a small VPS with a few vhosts on it).

    The default site, with a handfull of plugins enabled, but no-base OFF, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_off.png

    Same default site, with a handfull of plugins enabled, but no-base ON, and I get these results:

    http://i375.photobucket.com/albums/oo195/lantrix/loadtesting/Plugin_on.png

    This is repeatable, and the response time increases by 50% when the plugin is enabled.

    I’ll be trying a heavy load test on the site I initially had an issue with (dedicated server), and will comment again.

  18. says

    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?

    • says

      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.

  19. says

    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.

    • says

      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.

  20. says

    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.