There are millions of WordPress blogs on the internet and there are also many different opinions on which is the best WordPress permalink structure. If you search for “best wordpress permalink structure”, there millions of results and this article will also contribute to that collection!
So why should I write another article about WordPress permalinks? Hasn’t this been done to death? The short answer is that the majority of those “best wordpress permalinks” articles give bad advice which will make it very hard for you to change your permalink structure at a later date when you have hundreds or thousands of blog posts on your site.
Over the years I have setup quite a few WordPress installations with different permalink structures, but after doing all the research and finding what works best for me, I thought I had better share it with you… so you do not get your blog into a bad state that you cannot easily fix.
I will also show you how to change your permalink structure to the one I recommend without generating 404 File not Found errors for anyone linking to your posts.
What are WordPress Permalink Structures?
If you are reading this post, I assume that you already know what permalinks are, but I will give a short overview for those who are unsure.
So your readers can access your blog posts, WordPress needs to serve up those pages as unique URL’s. The way that the URL’s are displayed can be configured.
If you go into your WordPress Admin Panel and go to Settings -> Permalinks, you will be presented with the following page.
Here are the default suggestions from the page and the reasons why you should not use them:
- Default – http://www.domain.com/?p=123
This human unreadable format is useless for SEO purposes, but could be more efficient since it results in faster database lookups. Quite simply avoid this permalink structure since the efficiency gains do not help your SEO. You would be better off to move to a faster web server, rely on WordPress speed improvements as the core is updated or use caching plugins.
Verdict: Do not use.
- Day and Post Name – http://www.domain.com/2011/07/21/sample-post/
This permalink structure is better since it displays the post name in human readable form, but it also puts the post date in the URL. There is no need to put the date in the URL since you would not expect your readers to manually enter or change the URL’s. Some people have told me that they like to manually alter the URL so they can see what posts were made in say 05/2010. But seriously, your users should be using the web interface to select posts. Next time you are in Gmail, have a look at the URL. It’s a GWT application, but I don’t think there is any benefit in trying to manually punch values into the URL yourself. You are bypassing the applications API and this will generally lead to unpredictable results.
Verdict: Do not use.
- Month and Post Name – http://www.domain.com/2011/07/sample-post/
Same reasoning as above.
Verdict: Do not use.
- Numeric – http://www.domain.com/archives/123
This is similar to the default permalink setting. Might be slightly more efficient, but results in poor SEO.
Verdict: Do not use.
Here are some other common variations that I have seen:
- Category and Post Name – http://www.domain.com/category/sample-post
This one isn’t too bad since it is human readable and adequate for SEO. But there are a few reasons why I do not like it. The first reason is that by having the category in the URL means that you will not be able to rename or delete that category in the future (since other sites may have linked to that particular post). I like to keep my blogs organized and regularly move my posts into different categories, so this structure is not good for me. The second reason is that the keywords in the post name are pushed further away down the URL and hence the search engines will give less weighting to those keywords. It is simply best to have your keywords in the URL as close to the top level domain name as possible.
Another variation of this permalink structure is to use the tag name which obviously has the same disadvantages.
Verdict: Passable, but I would avoid it due to the reasons given above.
- Only Post Name – http://www.domain.com/sample-post
Right… we are now getting closer to the optimum permalink structure. This permalink structure has no dates, categories or tags, just the human readable post name which is located close to the top level domain. It’s just about perfect, but a little more research reveals the reason why it isn’t.
According to the Codex page on Permalinks, only postname may cause you problems “If you use postname as the only element in your permalinks to create a structure such as example.com/post-title, the rewrite rules may make it impossible to access pages such as your stylesheet (which has a similar format) or the /wp-admin/ folder. It’s best to include some numeric data (e.g. the post ID or date) in the permalink to prevent this from happening.”
Verdict: Passable, but this permalink structure may mask other similarly named files on your web server.
And the Definitive Answer is…
- Custom structure (Post Name and Post ID) -
This permalink structure is human readable, perfect for SEO, has the keywords close to the top level domain name and also contains a unique numeric identifier so it will not mask other files on your web server.
Having the Post_ID in the URL is also handy when you are hacking away in the database or you need to find a post quickly on your site after viewing logs etc.
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.
The permalink setting to use is: /%postname%-%post_id%/
Verdict: This is the one to use.
Does my Recommended Permalink Slow Down your Blog?
Previously (pre WordPress 3.0), my recommended permalink structure may have had slightly worse performance. But since WordPress 3.0, lots of changes have been made to the WordPress core, so this should no longer be an issue. But in any case you should do your own benchmark testing and make your own decision. You can always upgrade to a faster web server or use a CDN to boost your page load speeds. I run this permalink structure on WordPress sites with thousands of posts and have no issues. The SEO benefits far out-weight any slight loss in page load times.
How can you Change your Permalink Structure without Losing Page Rank?
You are probably in the situation that your blog has hundreds of articles that other sites have linked to. If you change your permalink settings, this will result in many 404 File not Found Errors and your site will definitely lose page rank.
I have been in this situation myself and there are a number of WordPress plugins that allow you to migrate from one permalink structure to another. Simple go to WordPress.org and search the plugin repository for “permalink”.
But there is one plugin that I have used in the past that is quite useful. As long as your original permalink structure had the post name somewhere in the URL, you can use the Smart 404 plugin.
The Smart 404 plugin stops your viewers from seeing site errors. When content cannot be found, Smart 404 will use the current URL to attempt to find matching content, and redirect to it automatically. Smart 404 also supplies template tags which provide a list of suggestions, for use on a 404.php template page if matching content can’t be immediately discovered.
I have successfully migrated sites from the “category-postname” and “postname” permalink structures to the permalink structure that I suggest without losing page rank or causing any other issues.
If you are setting up a new blog… then now is the time to get the permalink structure correct from day one.
One Last Note – Use Shortlinks for Internal Links
Now that you have setup your permalinks to use the structure I recommend, there is one last thing you need to be aware of. If you are linking to other pages in your blog, make sure to use the shortlink instead of the nice human readable URL.
You can determine the shortlink of any post by clicking the “Get Shortlink” button that appears when you are editting the post.
By using shortlinks, even if you do change your permalink structure at a later date, those internal links will still work ok.