Jan
18
2011

How to Setup Your WordPress Permalink Structure to Look Good, Perform Well and be SEO Optimized

Blue Wordpress Logo Permalinks 160px Thumbnail

One of the first things you need to do after installing WordPress is to setup the permalink structure. While it is possible to change your permalink structure once your website is up and running, my goal with this article is to provide you with enough information so you can make the right decisions from the start. Trust me, it will make things much easier for you down the line. Don’t worry if your WordPress site is already up and running though. You still can, and may want to, change your permalink structure. I’ll cover all the steps necessary to make a WordPress permalink change the right way in a follow up article.

Let’s begin by looking at what exactly permalinks are. Permalinks, as defined by the WordPress.org documentation, are described as:

Permalinks are the permanent URLs to your individual weblog posts, as well as categories and other lists of weblog postings. A permalink is what another weblogger will use to link to your article (or section), or how you might send a link to your story in an e-mail message. The URL to each post should be permanent, and never change — hence permalink.

The default permalink structure for WordPress looks like this:
http://www.yoursite.com/?p=N

This format performs well, but it doesn’t look good or provide any useful information to your visitors or search engines. Now lets take a look at how to set your permalink structure so it also looks good…

WordPress Permalink Settings

Luckily, WordPress makes it easy for us to setup a custom URL structure through the Permalink Settings menu (Dashboard → Settings → Permalinks). You should see a screen that looks like this:

Screenshot - WordPress Permalink Settings Screen

You’ll notice there are 4 different “common settings” listed on this screen. Personally, I like the middle two: “Day and name” and “Month and name”. Both of these perform well, and accurately describe the content. You’ll notice these two permalink structures on many of the top WordPress sites around (such TechCrunch, Smashing Magazine and Engadget). If you like one of these URL structures then just select the corresponding radio box, click the “Save Changes” button and you’re all set! Not quite sold? No worries, there’s also a text box at the bottom called “Custom Structure”.

How to Set Your Custom Permalink URL Structure

Once you select the “Custom Structure” option you’re able to enter anything you want. Well, not quite anything… There are a couple of important points to keep in mind when entering your custom permalink structure.

  1. You need to end your structure with either %post_id% or %postname%. This will ensure that each permalink points to an individual post.
  2. Performance. You should NOT begin your custom permalink structure with the category, tag, author, or postname fields. The reason is that these are all text fields, and using them at the beginning of your permalink structure will require WordPress to run more checks (and take more time) to distinguish your Post URLs from Page URLs. I won’t go into all the technical details here, but this is clearly stated in the WordPress Permalink Documentation, and there’s a great technical write up on this issue by Otto.

    Update (5/24/11): Joost de Valk of Yoast pointed out a great workaround to avoid any performance hit: use a caching plugin such as W3 Total Cache. This plugin will allow you use a permalink structure starting with the category, tag, author, or postname fields and not lose any performance. Thanks to Joost for the great advice!

  3. Instead, select a structure that starts with a numeric field, such as the year or post ID.

That’s right, the permalink structure “/%category%/%postname%”, which is recommended on a number of SEO blogs is NOT good to use on your WordPress site. Sure it looks good for SEO purposes, but it will have a negative affect on your site’s performance. The same goes for just using just “%postname%”. A lot of people don’t realize site performance is actually one of the factors included in your search engine ranking (Matt Cutts confirmed this on his blog). That means using one of these permalink structures might look good, but it could actually have a negative affect on your SEO effort.

So what should you use? As long as you follow these rules, you can use the following variables in your custom permalink structure:

  • %year% – The four digit year of the post (e.g. 2011)
  • %monthnum% – The two digit month of the year (e.g. 01)
  • %day% – Two digit day of the month (e.g. 15)
  • %hour% – Two digit hour of the day (e.g. 20)
  • %minute% – Two digit minute of the hour (e.g. 22)
  • %second% – Two digit second of the minute (e.g. 40)
  • %postname% – A cleaned up version of the title of the post. For example, “My First Blog Post!!” becomes “my-first-blog-post” in the URL. Do NOT start your permalinks with %postname% for performance reasons.
  • %post_id% – The unique ID # of the post (e.g. 218)
  • %category% – A cleaned up version of the category name (nested sub-categories will appear as nested directories in the URL). Do NOT start your permalinks with %category% for performance reasons.
  • %tag% – A cleaned up version of the tag name. Do NOT start your permalinks with %tag% for performance reasons.
  • %author% – A cleaned up version of the author name. Do NOT start your permalinks with %author% for performance reasons

Conclusion

Once you install WordPress you should put some thought into how you setup the permalink URL structure. Choosing the wrong structure can result in a lower search engine ranking and poor site performance. Taking the time to select the right permalink structure can help your site ranking and performance. It will also save you the trouble of having to change it in the future (which we’ll tackle in one of our next articles in case your site is already up and running and you do need to make a change).

Related Posts

About the Author: Dana Duncan

Hi, my name is Dana, and I've been building websites for over 12 years. It's a topic I'm passionate about and enjoy teaching. Here at All Webmaster.com I teach people how to create and run websites, and show businesses how to build or improve their web presence.

8 Comments + Add Comment

  • I actually enjoyed and learned reading this good post. The question in my mind is that, how the blogs that are using custom permalink structure i.e /cat/postname/ or /postname/ or /tag/postname/ are surviving out there if this is such a critical/serious problem in terms of performance of wordpress. I am about to set up a new blog with wordpress. The custom URL structure that i am thinking about after reading this post is /year/postname or /year/cat/postname. Your thoughts would be a great opening for me. Thanks.

    • Hi,

      The short answer is these “incorrect” permalink structures will have an affect on site performance that’s proportional to the size of the site. When you use one of these problem permalink structures, WordPress needs to run more calculations to determine what content the visitor is requesting. This means for smaller sites the performance hit may be so small it’s almost unnoticeable. The real performance problem begins when the site starts to grow.

      For example, if your site only has 10 pages / posts and WordPress has to run an extra 10 calculations per page, that’s 100 extra calculations. Most servers can handle that easily. On the other hand if your site has 1,000 pages / posts, that means WordPress needs to run 10,000 extra calculations. These calculations are also per page request, so if you have a couple hundred visitors all requesting pages at the same time you can see how the extra processing can add up quickly and result in slow site performance.

      Check out the writeup by Otto I linked to above if you want to get more into the technical details of why these extra calculations (which are called “verbose page rules”) are run if you use one of the problem permalink structures.

      To answer your other question, either of the two permalink structures you plan on using for your site will perform well since they start with “%year%”. I’d say go with the one you personally think looks better.

  • Ok, so I’ve set my site up with the post name (fairly new to wp and didn’t realize how this would affect the site performance) and need to change it to one of the recommended ways. I’m using WP 3.1 with the Thesis Theme 1.8; if I make the change what else do I need to do?

    • Hi Leslie,

      Don’t worry, this is a common mistake a lot of people (including me) make when they first start using WordPress. Luckily, it’s also easy to fix. I wrote a follow-up article with details on how to correctly change the permalink structure for an existing site that I think you will find useful.

      To summarize that article, the main thing you need to do is make sure you create 301 redirects so your old links will redirect visitors to your new URLs. You don’t seem to have too many articles on your site so I would recommend either creating the 301 redirects by hand if you’re comfortable with that, or creating the 301 redirects using the “Redirection” WordPress plugin if you prefer a non-technical solution.

      Best of luck,
      Dana

  • Thanks Dana! I haven’t closed this page and have refreshed occasionally hoping I’d get a reply! :) I will go read the article now…

  • Think I’m going to try the Redirection plugin because I like that it tracks changes….

  • Update: I re-read the info very carefully and decided the Platinum SEO Pack plugin mentioned would be a better option, so I deactivated the other SEO plugin I was using, then installed the one mentioned. Then I got cold feet and was scared to click…waited another day….but finally got my nerve up! Switched the permalinks to the year and month as mentioned and a BIG SIGH OF RELIEF…it was successful. I checked from external links back into the site as well as within the site and everything seems to be great. Thank you so much for the help you gave me!! :)

    • No problem! Glad to hear everything turned out well. If you found these articles helpful keep checking back on this site since I have a new series of articles, many around WordPress, that will be coming out over the next few weeks. I’ve also started posting my articles to Twitter if you want to follow us there…

      Good luck with the rest of your site setup. If you have any more questions that come up in the process let me know since I’m always looking for new topics my visitors are interested in.

Leave a comment

Welcome to All Webmaster!

Dana Duncan About Picture

Hi, my name is Dana and here at All Webmaster I teach people how to build websites. I've been creating websites professionally for over 12 years and this is where I'll share the things I've learned so you can build your own website and get people to visit it. [More about...]

Like Us on Facebook: