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.
There are three basic types of WordPress permalinks:
1. Default: “Ugly”
The default looks like
where N is the Post ID number. It works on all server environments, but it doesn’t look as nice as some of the other options.
2. mod_rewrite: “Pretty Permalinks”
Using mod_rewrite or lighttpd you can produce much nicer permalinks (see Pretty Permalinks). There are many different formats, but the most common, and most versatile looks like
http://example.com/category/post-name/ or http://example.com/year/month/day/post-name
Some people eliminate some or all of the date elements (day, month, year) to have a shorter permalink format.
PATHINFO: “Almost Pretty”
PATHINFO permalinks look very much like mod_rewrite permalinks but for one exception: they have /index.php inserted before them, like so:
Having your posts end in .html
There’s an easy way to having your posts end in a .html extension, using the structure tags above. Following the example used on properly terminating permalinks, you could have a page like http://yoursite.com/2006/01/01/happy-newyear.html with this rule:
Note that this does not generate static .html files. It only adds the .html extension, pages are still being dynamically generated. The SEO benefit to this is debatable, but it can be useful should you need to migrate away from WordPress, since the pages can easily be made static and retain their URL structure.
WordPress URL Rewrite
Have you ever tried to use Permalinks with WordPress running on an IIS server? What a pain. I created this ISAPI filter for IIS specifically to provide URL Rewriting for WordPress, without having to install and configure a full URL rewriting software package. This ISAPI filter allows you to create Permalinks that don’t suck, and it lets you do it very easily, with almost no configuration required. I have been using WordPress URL Rewrite on this site for a while now, and I feel that it is ready to be shared with everyone. Let me ease your pain!
1. Download WordPressURLRewrite from this site
2. Extract WordPressURLRewrite.ini to C:WINDOWSsystem32inetsrv folder
3. Extract WordPressURLRewrite32.dll (for 32-bit) or WordPressURLRewrite64.dll (for 64-bit) C:WINDOWSsystem32inetsrv folder
4. Edit the WordPressURLRewrite.ini file and configure it as required:
php#Paths to Rewrite (not case sensitive)
#Path Exceptions (not case sensitive)
- “#Paths to Rewrite” defines all the WordPress installations you would like to provide rewriting for
- For example, “/” provides rewriting for a WordPress installation running in the root
- “/wordpress/” provides rewriting for a WordPress installation running in the “wordpress” folder
- You can define as many WordPress installations as you want, just put each one on it’s own line
- “#Path Exceptions” is a very important section -- it defines all the folders you want WordPress URL Rewrite to ignore
- At the very least you should define “/wp-admin” and “/wp-content” so that WordPress can function correctly
- These 2 entries should be in the default “WordPressURLRewrite.ini” file
5. You also need to make sure you have these 2 settings in your PHP.ini file:
cgi.force_redirect = 0
cgi.fix_pathinfo = 1
6. Open Internet Information Services
7. Right click Default Website and select Properties
8. Click ISAPI Filters tab
9. Click Add
10. Set Filter Name to: WordPressURLRewrite
11. Click Browse
12. Select WordPressURLRewrite32.dll (for 32-bit) or WordPressURLRewrite64.dll (for 64-bit) in C:WINDOWSsystem32inetsrv folder
13. Click OK
14. Click Apply
15. Click OK
16. Open Command prompt and enter: iisreset
17. On WordPress Admin web, click Settings
18. Click Permalinks
19. Select Custom and enter this format: /%year%/%monthnum%/%postname%
20. Click Save Changes
21. You have pretty permalink now!