
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 refer to your article (or section), or how you might send a link to your story in an e-mail message. Especially when they are used to link to individual postings, once a story is posted, the URL to it should be permanent, and never change. Hence.. permalink.
By default WordPress uses web URLs which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links.To use the two pre-defined permalinks format you need to:
1. Enable these two settings in your PHP 4 php.ini file:
-
cgi.fix_pathinfo = 1
-
cgi.force_redirect = 0
This will allow these two permalink options to work:
Date and name based:
http://YOURDOMAIN.COM/index.php/2007/11/21/sample-post/
Numeric:
http://YOURDOMAIN.COM/index.php/archives/123
2. Make sure your PHP version is set to 4 in your control panel and set to use the FastCGI and not the ISAPI version.
Notice that you still need to have the index.php file in the permalink structure. This permalink option uses wordpress to rewrite the URL format using native PHP 4.
ADVANCED - USE A ISAPI URL REWRITER
If you wish to use a Custom Permalink Format and do more advanced URL Rewriting then you will need to ask support to install the IIS ReWrite DLL for your site. You can then use regular expressions to do URL rewriting much like that of the linux mod_rewrite module.
Here is an example of entries needed in your IsapiRewrite4.ini. This file will be located in your httpdocs directory. This example is written for a wordpress blog that is:
1. Installed in the root of the website.
2. Uses a Custom Permalink of: /%post_id%/%category%/%postname%.html
#RewriteLog C:\Temp
#RewriteLogLevel 3
# MaxMatchCount
#
# Specifies the maximum number of sub-expression matches to
# capture for a single pattern. This specifies the size of the
# array in the C module. If you have a pattern with more than
# the default number of matches, set this number.
#
# The default is 10.
MaxMatchCount 10
#
# /content/blogcategory/0/33/
#
# should translate to
#
# /index.php?option=com_content&task=blogcategory&id=0&Itemid=33
#Expects a Custom wordpress permalink of: /%post_id%/%category%/%postname%.html
RewriteRule ^/wp-admin/([^/]+)$ /wp-admin/$1
RewriteRule ^/([^/]+)/([^/]+)/([^/]+).html$ /index.php?p=$1
RewriteRule ^/comments/feed /index.php?feed=comments-rss2
RewriteRule ^/([^/]+)/([^/]+)$ /index.php?page_id=$1
#Add a rule for each page you wish to add in your blog. Lookup the page id from the admin section of wordpress
RewriteRule ^/page1 /index.php?page_id=2
RewriteRule ^/page2 /index.php?page_id=3
#Rule for RSS Feeds
RewriteRule ^/feed /index.php?feed=rss2
RewriteRule ^/$ /index.php
IterationLimit 10
NotParsed foo bar
Another solution exists using IIS' custom 404 redirects. It requires that you to add a custom 404 redirect, but it doesn't require you to install any 3rd party mod_rewrite software and it also doesn't require that your permalink structure begin with /index.php/. You can read about it here: http://einaregilsson.com/2007/07/30/pretty-wordpress-permalinks-on-iis/
|