The /%postname%/ Permalink Structure Debate

in Blog

In April 2010 I asked the question ‘What is the Best WordPress Permalink Structure‘. Before launching WP Mods I looked a lot into what the best permalink structure for WordPress was and, more specifically, if certain structures caused performance to reduce.

Chris Coyier raised this issue again a few weeks ago in his article ‘So really, don’t use just /%postname%/ as your permalink structure‘.

He noted that:

I used /%postname%/ as my permalink structure on CSS-Tricks for a long time. I have lots of Pages. My site went down. I changed my permalink structure to begin with a number. Now it’s fine.

He went on to say that when he changed the permalink structure from /%postname%/ to one od the default structures like /%year%/%monthnum%/%postname%/ he reduced the number of database caching queries from around 2,500 to 40. As someone who have researched this topic before and has an interest in optimising WordPress wherever I can, I took great interest in this fact. 2,500 queries being reduced to 40 is an incredible load to take off your server.

I therefore changed the URL structure of WP Mods briefly, cleared my cache and tested the speed the page loaded. I personally didn’t see any reduction of queries and Chris himself noted that WordPress developer Andrew Nacin encouraged him to tell people that is isn’t that bad to use /%postname%/.

Andrew Nacin

Chris suggested that WordPress should include a message advising people not to use /%postname%/ as a permalink structure due to performance issues however I have still never had any issues with using it. And as I pointed out last year, there are popular blogs with thousands of pages using this structure so it doesn’t seem to be a problem for most people.

For the time being, I am going to continue to use the /%postname%/ structure here. If it can be shown that this structure can seriously damage the performance of your website then I will have no hesitation is changing it though I agree with Joost de Valk who recently stated that ‘If you’re not willing to invest in WordPress hosting a bit, you might as well not optimize for search‘.

It’s worth noting that if you change your permalink structure from /%postname%/ to a structure such as /%year%/%monthnum%/%postname%/, WordPress will automatically redirect all of your articles to the new URL using 301 redirects. Be warned that this doesn’t happen in reverse. When I changed to the page was automatically redirected to the new URL, however when I changed the permalink structure back to /%postname%/ the URL produced a 404 page error. Bear this in mind when changing your permalink structure as if WordPress doesn’t handle the 301 redirect for you, you would have to install a plugin to ensure it was done.

Andrew Nacin also commented on Chris Coyiers article that ‘the chances are great that we’ll be removing all performance penalties for %postname% in the release of WordPress 3.3, due later this year’. This suggests that WordPress plan on changing the way they handle URLs, therefore if there are any slight performance issues with certain structures, they should be fixed by the end of the year. This is great news. After all, surely all permalink structures should be treated equally by WordPress from a performance point of view.


Related Links:

Comments (12)

  • Comment by Mark

    I really hope that 3.3 sorts this problem out as just being indexed is causing massive CPU usage on some of my new sites where if have used the /%postname%/ structure.

    Thanks for all the helpful comments above

  • Comment by Derek Kimball
    Derek Kimball

    This /%posttype%/ permalink structure is no longer an issue with the upcoming WordPress 3.3, according to the newly listed features of the beta version. This permalink structure is actually even listed as a permalink option. Sweet indeed.

  • Comment by Kevin Muldoon
    Kevin Muldoon

    Glad you found the article useful Tony.

    Andrew Nacin left a comment on the Digging Into WordPrss article I referenced on June 23 2011 stating that the chances are it will be resolved in 3.3 later in the year.

    He left another comment on August 17 2011 confirming that all permalink performance issues will be resolved in WordPress 3.3 (due around November 2011). So it should all be resolved within the next month or so :)

  • Comment by Tony Bianco
    Tony Bianco

    I ran across this article and it was a big help. I’d have to agree that using /%postname%/ for many sites is a better option.

    @Kevin, where did you find the comment about Chris saying that in 3.3 this would be addressed and changed?

  • Comment by Rahul

    Good tip! I think a lot of people leave it at the strange and ugly URLs that most of the CMSs create by default. Apparently, the claim is that this is better for SEO as well. I have been using /%category%/%postname%.html as my permalink structure for a while.

  • Comment by MaAnna

    I hope this issue will be resolved in the next release. And, I hope that having a bunch of pages is no longer an problem. I’m in the process of integrating a member site and have elected to have the info on pages instead of my blog, which I already use for other purposes.

  • Comment by Kevin Muldoon
    Kevin Muldoon

    I’m not sure how post types are affected. When I looked into this issue in great detail post types hadn’t been integrated into the WordPress core as yet.

    It hasn’t been updated in a few years, however the official documentation states that:

    “For performance reasons, it is not a good idea to start your permalink structure with the category, tag, author, or postname fields. The reason is that these are text fields, and using them at the beginning of your permalink structure it takes more time for WordPress to distinguish your Post URLs from Page URLs (which always use the text “page slug” as the URL), and to compensate, WordPress stores a lot of extra information in its database (so much that sites with lots of Pages have experienced difficulties). So, it is best for the first structure tag to be a numeric one, such as /%year%/%postname%/. (Some people recommend /%post_id%/%postname%/ which works for performance reasons but others recommend against it because it is unfriendly to users in the many contexts in which users interact with URLs.) .”

  • Comment by Susan

    Read that same article by Chris and I’m glad to know that this will be fixed in future releases (if it really is a problem). I haven’t tested it myself.

  • Comment by Clare

    From what I understand the reason you should use the date structure is because those come earlier in the loading script so the page loads more quickly. What I don’t understand is how this ties in with custom post types which use the format If numbers are better why are they not used for CPT?

  • Comment by Nathan B
    Nathan B

    I think the problem in Chris’ case was that he had so many (50+?) Pages, and the slowdown was that WP was checking both page slugs and post slugs? It wasn’t completely clear from his post, but I do think he and Andrew arrived at the fact that having just a handful of Pages and %postname% on Posts isn’t an issue. Is that right?

  • Comment by Kevin Muldoon
    Kevin Muldoon

    I wasn’t 100% sure if I’m honest though I hope that isn’t the case. I don’t think that the use of pages should be restricted for any reason. Certain areas of a site should always be set as pages in my opinion. For example, about and contact pages plus information pages that don’t age.

    I was encouraged by Andrew saying that they will be resolving this issue in the next version though.

  • Comment by laxmankasula

    Yes, All permalinks should be treated equally…
    I would still stick with /%postname%/. Hope the perfromace issues to be solved in WordPress3.3