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:
..which is dependent on the following code structure:
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:
..which is dependent on the following code structure:
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.
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…
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:
Well, that’s enough rambling for me — time to get back to work on the site! — Cheers ;)
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!
how about %postname%.html . would that help SEO and user legibility as well. setting up a site right now…
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! :)
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.
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.
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..
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.
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).
My pleasure, Adam — glad to be of service! :)
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!