Sep 23, 2009
For my sins, I use a webhost which works on Windows servers. For the most part, it makes not a jot of difference to me but does cause a few headaches when setting up sites using a wordpress install at the base of it. In particular setting nice pretty permalinks when I don’t have access to IIS mod rewrite rules…
I did manage it on this very siteÂ eventually, but it wasn’t straight forward particularly as I needed a separate 404 redirect for the subdomain (which I didn’t have access to). Setting up the new BVToday.net websiteÂ is more straight forward, but I thought I would post the solution here, partly for my own future benefit:
Requirements and Install instructions:
- IIS for Windows
- Ability to change your 404 error page with your web host.
To install, copy and paste this text into a file named wp-404-handler.php:
$qs = $_SERVER['QUERY_STRING'];
$_SERVER['REQUEST_URI'] = substr($qs, strpos($qs, ':80')+3);
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
Next set the 404 error page to /wp-404-handler.php. If it gives you a choice between file and url, choose url.
Lastly, make sure you enable permalinks in the WordPress control panel under Options > Permalinks.
This solution supercedes the ASP solution.