Fall Sale! Code FALL2024 takes 25% OFF our Pro Plugins & Books »
Web Dev + WordPress + Security

WordPress Lessons Learned, Part 1: Permalink Structure

While planning my current site renovation project, I considered changing the format of my permalinks. Reasons for modifying the permalink structure of a site include:

  • Optimizing URLs for the search engines
  • Simplifying URL structure for improved readability
  • Removing the implication that your site content is somehow organized chronologically
  • Removing other unwanted organizational implications (e.g., categorically, topically, etc.)

Like many people who configured WordPress permalinks a couple of years ago, I chose to include the day, month, and year along with the blog URL and post title. For over two years now, Perishable Press has employed the following permalink format:

https://example.com/press/2007/11/05/sample-post/

..which is dependent on the following code structure:

/%year%/%monthnum%/%day%/%postname%/
Update: In the URL example above, and in the examples following, I had to change perishablepress.com to example.com, because googlebot kept flagging the URL as 404 Not Found. Sigh.

At the time, this was the widely accepted and most popularly employed format for permalinks. Much of what we now know about search engine optimization, duplicate content, and canonicalization has changed the way many think about their permalinks. These days, the optimal way of writing your WordPress URLs represents a return to simplicity, readability, and a “flat” directory structure:

https://example.com/press/sample-post/

..which is dependent on the following code structure:

/%postname%/

This is the new format that I have been craving. It’s clean and crisp and represents my current mindset perfectly well. Nonetheless, after contemplating the various benefits, I considered the potential downsides to changing my permalink format:

  • Loss of link equity due to broken links, 404 errors, and other redirection nightmares
  • unnecessary confusion from missing content and broken links inflicted upon site visitors
  • Unforeseen conflicts with WP 2.3 and other scripts, plugins, and themes
  • Need for secondary set of htaccess rewrite rules

Clearly, plenty of great reasons either for or against such a drastic move. Finally, while comparing the options and considering a final decision, I decided to take a few steps back and look at the “big picture” for a moment: is it really necessary to change the format of permalinks this late in the game? No, it is not. A tighter permalink structure may prove beneficial according to several of the reasons previously outlined, but the potential drawbacks associated with permalink modification are not worth the risk. At the end of the day, the permalinks for this site, although dated (pun intended), are well-established and happen to work just fine. Although it would be a complete bonus and possible benefit to restructure my permalinks at this point, I see no long-term benefit to a simplified format. In fact, in the long run, say after another five or ten years, this site will house a virtual ton of content and may very well benefit from the current permalink structure.

As many of us know, permalinks require Apache’s mod_rewrite module and involve various rewrite directives, and an htaccess file. If you have ever experimented with various htaccess tricks, you totally understand the highly sensitive and volitile nature with which they operate. htaccess is powerful stuff — messing with a well-established permalink structure requires modifying htaccess rules, and should be approached with great care and understanding. This is not meant to scare anyone from trying to reformat their permalinks, it is merely a reminder that “if it ain’t broke, don’t fix it,” and, “if it is broke, make sure you know what you’re doing before making any changes.”

Allow me to conclude with a word of advice to new bloggers out there who may be establishing the structure of their own permalinks. If I could go back and begin Perishable Press with the knowledge I have gained over the past two years, I would have went with the simplest format possible. In other words, my permalinks would look something like https://example.com/sample-post/ and that’s it. Including the date string (e.g., /2007/07/07/) in the URL is unnecessary because WordPress inherently organizes your content chronologically. Organizing and displaying your content chronologically is your choice, however, once you decide to include the date in the URL, there is no (easy way of) going back. Likewise, including the post categories in your permalinks cements each category permanently, making it much more difficult to rename or remove it in the future.

Regardless of the permalink structure you decide to use, I highly recommend planning as far into the future as possible and/or necessary. If you have any intention whatsoever of continuing your site for any serious amount of time, it behooves you to contemplate your site as it may exist “x” number of years from now. For example, are you absolutely certain that you will never want to change your categories? Which permalink format affords the greatest degree of flexibility? Factoring such considerations into your decision-making process will serve you well regardless of where your blog ends up.

About the Author
Jeff Starr = Web Developer. Book Author. Secretly Important.
GA Pro: Add Google Analytics to WordPress like a pro.

14 responses to “WordPress Lessons Learned, Part 1: Permalink Structure”

  1. I agree – if I had my time over I’d go with just postname. There are plugins (such as Deans Permalink Migration) which can redirect the URLs for you if you do change your permalinks, but I’m of the “if it ain’t broke, don’t fix it” school of thought as well. I don’t think the small benefit is worth the risk.

    Also, I totally agree with you that people should be careful about using category in permalinks. It means you can’t tweak your category structure without breaking your permalinks. Also, if you accidently post using the wrong category, changing it to correct category will break the permalinks created by your pings.

    Great post and clear thinkng…

  2. Perishable 2007/11/06 9:46 pm

    Yes indeed, well said: “if it ain’t broke, don’t fix it” — so true. Of course, if there are clear and measurable benefits, there are many methods of implementing permalink changes. There are plugins (as you mention), PHP techniques, htaccess tricks, and even hardcore database alterations that may be employed. For a newer blog, changing permalink structure may be worthwhile, as the total number of redirects is relatively few. On a site such as this, however, there are nearly 400 posts, a handful of pages, and several other bits and pieces that would, I’m afraid, leave me and my site in utter ruins if even the slightest glitch reared its ugly head.

    Also, you article mentions the potential cons for using only %postname% in permalinks. I have read the reports of this on several occasions but have never encountered a real-life situation in which any such issue occurred. Of course, anything is “theoretically” possible, but I don’t believe the hype, personally. I have seen and worked with far too many sites that employ postname-only permalinks with great success to believe otherwise.

    One more point before I dive back into the site redesign: some people will argue that using only %postname% for the permalink structure causes problems if two (or more) posts happen to have the same title (Happy Halloween, et al). This is also nonsense because WordPress automatically appends a dash-numeral to the end of any duplicate post slugs. So, for example, a second post entitled “Congratulations” would appear as this in the permalink:

    http://your-site.com/congratulations-2/

    Well, that’s enough rambling for me — time to get back to work on the site! — Cheers ;)

  3. Yes, just using %postname% is no longer a problem. One of the commentators states that the problem the Codex mentions was fixed in WordPress 1.5! There are many people using this permalink structure and no hints of any problem. As you say there’s no problem with duplicates. If I was starting a new blog, I’d just use %postname%.

    Good luck with the work on your site. It looks great!

  4. how about %postname%.html . would that help SEO and user legibility as well. setting up a site right now…

    thanks!

  5. Perishable 2008/02/10 4:51 pm

    As far as I know, search engines in general do not place greater ranking preference on pages referenced via file names (e.g., ../postname.html) as opposed to those linked via some sort of “pretty permalink” (e.g., ../postname/). This is one of those weird SEO myths that continues to persist. Feel free to use the format that best suits your needs! — Best of luck with your new site, btw! :)

  6. thanks and thanks :) I’ve been building static sites and using .html for so long it’s like seeing a sentence without punctuation to not have a file extension, and even a final / still seems a bit lonely out there. I did follow your advice and just went went with %postname% and edited my slugs as well to make them meaningful for SEO. I’m bit late to Word Press so luckily I can benefit from others’ hard learned lessons.

  7. Alexander Sandler 2008/08/21 4:09 am

    I came to similar conclusions regarding %postname% only permalinks. To address the problem of broken links I use a plug-in named Permalinks Moved Permanently. It is available from: http://www.microkid.net/wordpress/permalinks-moved-permanently/
    It does the job for me.

    I found another problem with permalinks. From some reason my permalink settings do not apply for pages in WP 2.6.1. From some reason, page URL always built of parent page slug followed by the actual page slug. Wondering if you have similar problems.

  8. Jeff Starr 2008/09/01 9:11 am

    Hi Alexander, Thanks for the tip on the Permalinks plugin, looks like a good thing to have in the toolshed.

    As for permalink settings not being applied to pages in 2.6.1, this is the first I am hearing of it. If you are referring to actual “page” pages, I think I recall reading somewhere about a new setting or parameter that controls that functionality..(?) Not sure..

  9. Srikanth Shet 2008/10/01 3:50 am

    Hi,

    I can set the permalink in the WordPress for the posts. When i was set to post, the category links are not working. pls help me.

  10. Adam Singer 2008/10/14 2:13 am

    Thanks for this. You’re right, if it isn’t broken, don’t fix it. I was about to update my permalinks and install a plugin to redirect, but that’s throwing complexity into something that works just fine. Why bother, I am ranking well in search engines so it would totally be a vanity thing. Thanks for saving me from what could have been a headache (ht access files ARE a pain to work with).

  11. Jeff Starr 2008/10/19 2:40 pm

    My pleasure, Adam — glad to be of service! :)

  12. Palma | Buddha Trance 2009/03/07 4:21 pm

    Perishable, your post is such a relief for me! Especially because I trust your knowledge in WordPress matters. I have adopted the postname only permalink, since the beginning. I initially chose this format for SEO purposes. Today, I just became aware of the Codex recommendations about it not being a good thing, and the mod_rewrite table in the database becoming overly inflated… and started wondering if I had made the right decision.

    Reading your post on the subject, is now making me feel much, much better. I will keep the postname format. Thank you!

Comments are closed for this post. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
Digging Into WordPress: Take your WordPress skills to the next level.
Thoughts
Went out walking today and soaked up some sunshine. It felt good.
I have an original box/packaging for 2010 iMac if anyone wants it free let me know.
Always ask AI to cite its sources.
All free plugins updated and ready for WP 6.6 dropping next week. Pro plugin updates in the works also complete :)
99% of video thumbnail/previews are pure cringe. Goofy faces = Clickbait.
RIP ICQ
Crazy that we’re almost halfway thru 2024.
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.