A “permalink” is a permanent link url that points to a specific blog page or post. They are essentially permanent links to your website pages that should remain unchanged indefinitely.
Permalinks can be quite powerful if used correctly and are most commonly known for their cosmetic and SEO benefits.
Common Permalink Structures
By default, WordPress uses a simple numeric variable structure that looks like this:
http://www.appthemes.com/?p=123 |
It’s not pretty nor does it tell you what the post or page is actually about but it’s probably the best performing.
Some other common custom permalink structures are as follows:
/%postname%/ /%category%/%postname%/ /%year%/%monthnum%/%postname%/ |
What is the Best Permalink Structure?
That’s a great question and there is no right answer. It really depends on what’s most important for you and how large your site currently is or plans to be.
We’ll give you all the information you need in order to decide which custom permalink structure is best for your website. There are so many different opinions out there so it’s best that you know the facts and choose what you feel is best for you.
Permalink Structure for Performance
If you plan on running a site with hundreds or thousands of posts and you want to ensure it can scale and stay speedy, here are a few rules you should abide by:
- Don’t start your permalink structure with the category or postname fields. For example:
/%category%/ /%postname%/ |
These are the most resource intensive custom permalink structures because they are text fields and at the beginning of your permalink structure. It takes more time for WordPress to distinguish your post URLs from page URLs and needs to store additional meta data in your database.
- Select a structure that starts with a numeric field (i.e. the year or post ID) or with a hard-coded base path (i.e. /posts/)
/%year%/%postname%/ /%post_id%/%postname%/ /posts/%postname%/ |
Permalink Structure for SEO
Most website articles tell you the best custom permalink structure for SEO-benefit is just the postname. In fact we’ve been a strong advocate of this structure as well and still believe it’s crucial to use — but it’s not necessarily for everyone.
/%postname%/ |
Having years of experience with SEO, we understand what it takes to help rank websites higher. Having short urls (not multiple levels down) with keywords, will definitely be more beneficial than using a date or post id permalink structure.
We’ve used this on dozens of WordPress sites without any problems at all. Keep in mind though, that most (if not all) of our WordPress sites have been less than a few hundred posts so performance has never been an issue. We also use cache plugins which help too.
If your site is large or you’d like to make sure it’ll scale, this permalink structure is not the best for you.
Regardless, we still stand by that permalink structure as the *best* for SEO-benefits.
Permalink Structure Best of Both Worlds
Now that you’ve seen both extremes, how about a happy medium? You got it. We’ve cooked up a couple of our top recommendations which address all the core benefits of both.
- Select a hard-coded base url – This addresses the speed, usability, and SEO issues all rolled up into one. The SEO takes a slight hit with this structure because each post is one level down vs being at the root.
/blog/%postname%/ => http://www.appthemes.com/blog/the-post-title/ |
- Include a numeric value at the beginning – This structure also receives high marks for speed, usability, and SEO but with a few differences. Since there’s no sub-level (/blog/), you get more SEO weight. On the other hand, you sacrifice looks because the post number comes at the beginning of the url. The numeric value needs to come first for WordPress to look it up.
/%post_id%-%postname%/ => http://www.appthemes.com/123-the-post-title/ |
Something else worth mentioning is that Google News requires any article to contain a three-digit unique number in the permalink in order for it to be indexed.
Now this is Google News and not regular Google search results but it’s still an added benefit of having the post id or date included in the permalink.
The only issue is Google News won’t pick up your first 99 posts/pages because they are only two digits.
Ideal Permalink Structure
In a perfect world, WordPress’ permalink engine would be better written for performance so the custom permalink debate of speed vs SEO would be put to bed. I know it’s come a long way from the early days but this is something that would be great to have addressed in an upcoming version.
There’s been a couple of Trac tickets logged (#12935 & #16687) requesting some enhancements which will hopefully solve this issue.
So WordPress – if you’re listening – here are the top two ideal custom permalink structures that will benefit everyone’s needs from an SEO, organizational, and compliance standpoint. All you would need to do is locate the post id in the url instead of searching from the left.
/%postname%-%post_id%/ => http://www.appthemes.com/the-post-title-123/ |
OR
/%category%/%postname%-%post_id%/ => http://www.appthemes.com/news/the-post-title-123/ |
It’s how our AppThemes Forum urls are setup.
UPDATE 8/15/11 – After speaking with Otto (WordPress core contributor) at WordCamp SF, the /%postname%/
or /%category%/
permalink structures will no longer take a performance hit as of WordPress 3.3 (due out later this year). This is great news and not only solves the performance vs SEO compromise, but also puts the age-old debate to rest. An article on WPCandy has also been written about it.
What the AppThemes Website Uses
On the AppThemes.com blog, we took into consideration speed, usability, and SEO. The outcome ended being a mixed method so all our posts fall under a hard-coded base path which looks like this:
/blog/%postname%/ |
Here’s our reasoning behind this structure:
- Hard-coded base path performs faster than just the postname (or other structures).
- The URL structure is SEO-friendly & also looks clean in snippets that are displayed in search engine results pages.
- The structure doesn’t contain dates. We generally try to write “timeless” blog posts that should stay relevant for a longer period of time.
- Keywords in the URL are separated by hyphens and not underscores as suggested by Matt Cutts (SEO authority at Google).
If we had to do it over again, we’d also add the post id at the end of the postname just so our urls would comply with Google News’ policy.
/blog/%postname%-%post_id%/ |
Can I Change My Established Websites Permalinks?
Yes but we don’t recommend changing your existing permalink structure if your site has been established for a while (over six months or with a lot of backlinks).
Why you may ask? The main reason has to do with other sites linking to yours. Those links which not only drive traffic to your site, also help you rank higher in search engines. Changing your permalink structure will break those inbound links unless they are handled properly.
A good analogy is your current residence. All your mail gets sent to the same home address, right? Say you get up and move next week without letting anyone know your new address. What happens to all your mail? It gets lost or returned to sender.
The same holds true when it comes to your website urls. If you don’t setup the proper 301 redirects, you lose all link juice and those inbound links.
Back to moving houses. You wouldn’t move without contacting the post office and setting up a mail forwarder first, right?
So yes, you technically can change your permalinks on an established site but just make sure you do it correctly (i.e. using 301 redirects). There are several plugins out there which can help you with this.
If you have thousands of posts and pages, a more efficient way would be to add rewrite rules to your .htaccess file. This is something technical that most people aren’t able to do, however.
In that case you should hire a developer or system admin who has experience with regular expressions and apache rewrite rules.
WordPress Permalink 404 Error
This is a typical “Page Not Found” error message WordPress bloggers will see. It usually means that something is not setup correctly with your WordPress permalink structure.
With the recent rise of usage of custom post types, this error has popped up even more. In this case the solution is quite easy. Just go and re-save your permalink structure after you have added a new custom post type (or theme that uses custom post types).
References
- Category in Permalinks Considered Harmful – OttoPress Blog
- Using Permalinks – WordPress Codex
- Best Permalink Structure for Scaling – WPMU.org
- WordPress Permalinks Structure – Labnol.org
Like this tutorial? Subscribe and get the latest tutorials delivered straight to your inbox or feed reader.