An Efficient Structure for WordPress Permalinks
WordPress offers you plenty of options for choosing a permalink structure for your blog. For instance, you can chose to have dates, post IDs, categories or even the name of the author in the pemalinks (short for permanent link).
The URL structure that you see on this blog uses the following custom format:
/%category%/%postname%/%post_id%/
So if I am writing an article on WordPress Tips under the Blogging category, the URL of that post will look something like this:
http://labnol.org/Blogging/WordPress-Tips/1234/
Here are some reasons why I chose such a permalink format:
#1. The URL structure is SEO-friendly and also looks clean in snippets that are displayed in search engine results pages.
#2. The structure doesn’t contain dates. I generally try to write “timeless” blog posts that should stay relevant for a longer period of time and hence skipped the date completely from the URL - the date is anyway displayed in blog articles and sometimes even in search snippets as in the above screenshot.
#3. Google News includes quite a few multi-author blogs in their index and one of their technical requirements says that all article URLs must contain a unique number. If in future, this blog grows and gets included into Google News, I won’t have to alter the permalink structure because there’s a unique number already in the URL – it’s called Post ID.
#4. Words in the URL are separated by hyphens and not underscores as suggested by Matt Cutts in one of the WordPress camps.
The Problem with this URL Structure
Now before you use a similar permalinks structure for your own blog, let me share a problem – this structure can make you site a little slow. That’s because WordPress will have to run some extra queries each time to figure out whether the URL matches a WordPress page or an individual post.
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).
They have raised a ticket for the above issue but it won’t be fixed until WordPress 3.0 so you are better off not using the structure that I am using.
What’s the Best Permalink Structure
If you are looking for performance, the best permalink structure would just have the /%post_id% in the URL. That’s however not very SEO-friendly so you may consider going for a structure like the one below (there’s no trailing slash).
/%post_id%/%postname%
I know you can change the permalink structure anytime (Tools -> Permalinks) and WordPress will do a 301 redirect from the old URLs to the new ones but that might push your site out of Google’s index for some time so there’s a bit of risk involved.
Amit Agarwal
Google Developer Expert, Google Cloud Champion
Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.
Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory