A common problem when running WordPress under Windows and IIS is how to handle URL Rewrites. URL Rewrites are usually used with WordPress to format the permalink structure of post URL’s in a nice way, and to remove the need for having index.php in every URL. Apache servers handle this with ease using the widely included mod_rewrite plugin, but unless you’re running IIS 7+ on Windows, you have no such capability without some 3rd party help.
If you’re not already up and running with Rewrites on your Windows Server, download and install ISAPI_Rewite Lite (free), then follow the installation instructions to get going.
Note: If you’re running IIS 7 or greater see the IIS Module and instructions.
The remainder of this post will speak to IIS6.
Now that you have the ISAPI Rewrite module installed, you can use the Helicon Config Editor to make changes to your .htaccess file although you probably won’t need to just yet. The first thing you’ll want to do is to log into your WordPress install and enable the permalink structure you require. This will create an initial, and presumably working, .htaccess file at the root of your install.
- Log in to the Admin section of your WordPress install by going to http://www.yourdomain/wp-admin
- Click on Settings -> Permalinks
- Choose your link structure or enter a custom one
Then click Save to create the rewrite rule. If you get a permission error, you’ll need to grant read/write/execute permission to the account you have PHP running under (i.e. Network Service). Once you are successful, test out your site by navigating to the blog home page and then click on a single post. If it loads and the URL looks like your desired structure, you’re in business.
This process should have resulted in a .htaccess file that looks similar to the following
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
If you run into an issue where your having trouble reaching the wp-admin page after setting up your Rewrite rules, have a look at Correcting wp-admin 404 error for wordpress under IIS.