How to set up pretty permalinks in WordPress
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:
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.
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