I finally got them working. The links are looking different now on my site — instead of having links that look like http://www.simmonsconsulting.com/?p=204, they are more descriptive (search engine friendly), as in http://www.simmonsconsulting.com/2005/11/22/wordpress-permalinks-on-iis/. It’s a little thing, but I have been fussing with it for several months. It’s mostly due to this post, but I had to modify the php code a bit to work on my site.
I can share it if you are interested, it is a small fix.
I’ve decided to put it up because I know there are many folks out there that want permalinks on IIS without using ISAPI_Rewrite or any other addon.
First, create a file in the root of your WordPress installation. I called my wp-404-handler.php. Here are the contents of mine:
$my_wp_url = "http://" . $_SERVER['SERVER_NAME'] . "/wordpress";
$_SERVER['REQUEST_URI'] = substr($_SERVER['QUERY_STRING'], strpos($_SERVER['QUERY_STRING'], $my_wp_url)+strlen($my_wp_url));
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];
You might need to edit line 2 to change the last string in quotes to be the name of your WordPress installation directory. Mine is “/wordpress” but your’s might be “/blog” or “/wp”. Once you have made that change, upload this file to the root of your WordPress directory.
Now you need create a custom 404 handler using the IIS Manager on the web server. If you have console or remote desktop access to your server, simply open the IIS Management snap-in and right-click on the web site you want to modify and select “Properties”. Now, click the “Custom Errors” tab and scroll down to the entry for 404 errors. Click the “Edit Properties” button and change the Message Type to “URL”, then type in the relative URL to your wp-404-handler.php file, in my case “/wordpress/wp-404-handler.php”.
You might need to restart IIS before the change takes effect. Happy permalinking!