ThemeLab's Blog

Stay up to date with our newest WordPress themes, WordPress plugins, WordPress tutorials, and other announcements.

How to set up pretty permalinks in WordPress

Last Updated on by

If you have just set up a WordPress blog, and want to change your permalink structure from the ugly and non-descriptive permalinks such as http://yourdomain.com/?p=1 and http://yourdomain.com/?page_id=2 to nice looking URL’s, read on. In this tutorial we’ll go over:

  • Where to customize your permalink structure in your WordPress admin pane.
  • Date and name based permalinks
  • Numeric based permalinks
  • How to make your own custom permalink structure

Pretty soon you’ll have SEO-friendly and descriptive URL’s for your WordPress site.

Part 1: Where to go
Built in with every WordPress installation is a menu to customize your permalink structure. Simply go to the Options menu and select the Permalinks tab. Your screen should look something like this:

Customize Permalink Structure

At this screen, it should be fairly self-explanatory to choose some of the predefined permalink options. Theme Lab actually uses the Date and name based option, which you can see in the URL right now. The numeric based permalinks will simply take your post ID number, and append it to the URL.

These permalink options require your .htaccess file to be writable. If it’s not, WordPress will generate the code you need to copy manually into your .htaccess file to enable the mod_rewrite capabilities. You’ll have to create a file called .htaccess in your WordPress root directory if it doesn’t exist already.

Part 2: Customize your permalinks
This will take you beyond some of the predefined options within the permalinks menu. As outlined on this page in the WordPress Codex, there are a number of tags available to customize your permalinks even further. In addition to %year%, %monthnum%, %day%, %postname%, and %post_id% — you can use:

  • %hour% – The hour of the time stamp of your post (1-24)
  • %minute% – The minute of the time stamp of your post (1-60)
  • %second% – The second of the time stamp of your post (1-60)
  • %category% – The category slug (wordpress-tutorials)
  • %author% – The author’s name (Leland)

For our example, let’s just choose to have Date and name based permalinks. If your .htaccess is writable, you should get the following message.

Permalink Structure Updated WordPress

When you’re done, you should have the exact same link structure as used here on Theme Lab. These links are known to help with search engine optimizations, much more desirable than the old ugly URL’s (/?p=1 and ?page_id=2). If you liked this tutorial, feel free to comment and share! Also feel free to subscribe to our Feed

About

Leland Fiegel was the original founder of ThemeLab. He is a web developer who loves WordPress and blogging.

  • http://www.beautifulsummermorning.com Nick Grimshawe

    Thanks for the tips. Your notes are very clear and easy to follow.

    Nick

  • Leland

    No problem, glad you liked it.

  • http://www.leadhumancapital.com admin

    thanks for the info, I manage to complete the first step( changing my permalink Date and Name option, however, I dont know how to create .htaccess, should I open the cpanel and create a folder for that(in my public html)?

    thank you

  • Leland

    Does WordPress not create an .htaccess automatically? If not, you need to create a blank one in your WordPress root directory and set the permissions to 666 so it can write to it.

  • http://www.leadhumancapital.com admin

    Yes, it does..thanks, I just checked it few minutes ago in my filezilla. Thanks,it is a great help, anyway for my additional info, what do you mean by set the permissions to 666?

    I will backlink you on my website so that others can learn as well from you.

  • Leland

    If the .htaccess wasn’t writable, you would’ve had to set the permissions to 666 for it to work on your host…but I guess you won’t have to worry about that. Thanks!

  • http://www.jeffagogo.com Jeff

    I’ve been looking into changing my permalinks from the default ugly http://yourdomain.com/?p=1 to something else. Then I noticed that some newspapers(but not all) websites don’t use descriptions in their url’s but complex page numbering system. eg :
    http://www.news.com.au/perthnow/story/0,21598,23403365-5005364,00.html

    or:

    http://www.straitstimes.com/Latest%2BNews/Asia/STIStory_229547.html

    Is there a case for keeping the old ugly method, on the basis, that it make no difference at all. Why are these newspapers opting to use this method? Infact the ugly url is shorter and simpler for wordpress. Any thoughts?

    • http://www.siteriver.com Phillip Barnhart

      “0,21598,23403365-5005364,00.html” is actually old-style Vignette StoryServer format. It was used to allow a database to run with a template.

      Many news organizations use numbers in their URL for version control – especially if the same story is updated several times a day.

      Finally, Google News requires news sources that do NOT use news sitemaps to have at least three numbers in their url.

  • Jeline

    I can’t find my .htaccess in my root directory :( how can i make one? please help me!

  • http://www.bestonlineresults.com JM

    Isn’t there a short snippet of code that you can add to your .htaccess file in order to make is writable?

  • adi

    hi! i got problem here..what if the .htacces file is not writable? i can’t find the .htacces in my directory and filezilla couldn’t show the hidden file too (im not sure if the.htaccess file is hidden or not). do you have any idea?

  • http://www.internetsuccessguide.com/blog Emmanuel

    Thanks for the valuable information,

    Are there any SEO benefits in using a %category% %post-name% perm-a-link?

    Emmanuel.

  • http://www.lenocin.com Len Ocin

    How about permalinks for pages, not posts?

    Reason is I’m digging into creating WordPress themes to use WordPress as a CMS, rather than blogging system.

  • Leland

    @Len: When you set the post permalinks to anything…it should give the pages pretty permalinks as well.