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

Subscribe to RSS

By: Leland on Mar. 11

Bookmark and Share

14 Comments »

Comment by Nick Grimshawe
2008-03-11 23:08:31

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

Nick

 
Comment by Leland
2008-03-12 11:23:39

No problem, glad you liked it.

 
Comment by admin
2008-04-10 18:49:34

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

 
Comment by Leland
2008-04-10 20:05:43

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.

 
Comment by admin
2008-04-10 23:58:28

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.

 
Comment by Leland
2008-04-11 00:00:47

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!

 
Comment by Jeff
2008-04-21 00:42:26

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?

Comment by Phillip Barnhart Subscribed to comments via email
2008-11-15 13:26:31

“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.

 
 
Comment by Jeline
2008-09-05 22:10:08

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

 
Comment by JM
2008-10-12 01:43:15

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

 
Comment by adi
2008-12-27 15:38:28

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?

 
Comment by Emmanuel Subscribed to comments via email
2009-03-30 14:11:21

Thanks for the valuable information,

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

Emmanuel.

 
Comment by Len Ocin Subscribed to comments via email
2009-05-03 09:14:29

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.

 
Comment by Leland
2009-05-04 07:13:20

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

 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

Trackback responses to this post

Recent Comments

  • Anto: Hello. Thanks, you’ve got my contact details. Get in touch with me if your wanting something in your own...
  • Sonny: Hey Anto, I love this design, good work that I paid for link removal :) Anyways, how can one contact you to do...
  • Leland: @axelk: As in picture uploads? Not sure about that, although you could set up the form to allow users to send...
  • axelk: thank you for the reply. can Contact 7 be used to submit pictures as well?
  • Leland: @axelk: I think that’s what the Contact Form 7 is for. Although if you wanted to allow users to submit...

About The Author

Welcome to Theme Lab. My name is Leland, and I run the place. I write all the tutorials and code all the themes you see here on the site.

For more information about me, feel free to read the about page. If you want to drop me a message, feel free to contact me.

Interested in advertising on Theme Lab? We have advertising available at very reasonable rates. Head on over to the advertising page for further details.

Please read our Privacy Policy and Terms of Service in regards to theme usage.

© 2009 - Theme Lab - Powered by WordPress