Firstly – appologies to everyone who visited this blog over the last couple of days because my URL Rewriting was all wonky. Now it’s working again thank God (and a few handy websites) and back to normal. Thanks for your patience.

If you need to find out how to install IIRF on Windows have a look at this post first. It’s a complete walk-through from start to finish that will get IIRF up and running on IIS6 in no time at all.  (This post is now pretty much redundant as the walk-through goes in to far more detail for both WordPress and Drupal installations than this post does.

This post is about how to get IIRF working on IIS6 running the fabulous WordPress.

Obviously you will need to change the domain name from CaspianIT to your own domain. I found parts of this code on a blog posting by John Sheehan, thank’s John! I did find that the code on John’s blog didn’t quite work for me, but there was some code on one of the comments on other blogs that when combined worked perfectly. You can read John’s blog posting here.

*Update*

I thought I would come back to show you the latest modifications to my IsapiRewrite4.ini file, this is the script that is running right now to deliver this very page you are reading right now – this is what it does and I think it will probably be  suitable for majority of bloggers needs – thus the update.

RewriteCond %{HTTP_HOST} ^(caspianit\.co\.uk).*$ [I]
RedirectRule ^/(.*)$ http://www.caspianit.co.uk/$1 [I,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /index.php/$1 [L]

The above script will change any page from an http://caspianit.co.uk request  to a http://www.caspianit.co.uk

The reason I decided to go with the addition of the www instead of without is because the administration pages won’t work without the www! Yes I could put further conditions that would check for the ‘wp-admin’ and then not to rewrite the URL, but rather than complicate things further it’s easier just to go with the ‘www’ bit. Another reason is because if you’re using the XMLSiteMap plugin, it will write all our URL’s with www. attached to the URL.

One the second line the [I,R=301] does this: The I (must be a capital ‘I’) tells IIRF to no be case sensitive (which is quite ironic having to be a capital I – lol) and the R=301 tells the search engines that this is a permanent Redirect (301) to this URL. Using the R=301 will help your rankings in the search engines because Google et all will quite happily crawl both the http://www.yourdomain.com/yourpage AND http://yourdomain.com/yourpage and treat them as two completely separate pages – and then mark you down for having duplicate content – doh!

For the vast majority of you who don’t have a .co.uk domain name (or at least is you have a .com or similar) change the first line to the following:

RewriteCond %{HTTP_HOST} ^(yourdomainname\.com).*$ [I]

And that should do it. Obviously there are many different configurations but the script above should suit most WordPress installations. I think IIRF is great, it’s not only FREE it’s also powerful and it doesn’t have ridiculous licensing constraints on it. It may take a tiny bit of effort to set up but really it’s not a lot more than other ISAPI Re-writers and it doesn’t cost $99!

I hope this works for you.

Simon

0 comments

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>