Soon after I installed WordPress on my Windows Home Server (WHS) which runs IIS I realized my permalink options were limited since IIS does not support mod_rewrite. I definitely wanted to produce Pretty Permalinks, therefore, I spent some time searching plausible solutions that would mimic mod_rewrite capabilities so I could accomplish this goal. What I found were several workaround tutorials that explained how to create 404 redirects while others provided instructions on how to use PHP and INI files in association with a ISAPI Rewrite Filter. Nonetheless, I was not interested in going through all the tedious steps in these workarounds so I continued doing my homework. Thanks to a project on Google Code I was able to find a solution that works perfectly and only takes minutes to implement.
Before I take you through the steps let me back up a minute for those of you who are not familiar with Pretty Permalinks. Permalinks are the permanent URLs to individual blog posts, as well as archives, categories, and other blog postings. According to WordPress, “Pretty Permalinks is the idea that URLs are frequently visible to the people who click them, and should therefore be crafted in such a way that they make sense, and not be filled with incomprehensible parameters.” For example, if you choose the permalink “Month and Name” option it would produce a URL that would look like this:
Notice that the URL includes “index.php” and what we want to do is eliminate this section of the URL so we can produce an even “Prettier” Permalink that looks like this:
http://www.yoursite.com/2009/03/11/sample-post/ – minus the “index.php.
This will not only shorten the URL and make it “prettier,” depending on your permalink structure, it could be beneficial when it comes to Search Engine Optimization (SEO).
What You Will Need
Download the latest binary zip for your OS from Google Code.
- Unzip the “wp-url-rewriting” file.
- Copy the “wp-url-rewriting.dll” to an existing directory or create a new directory.
- Open the Internet Information Services (IIS) Manager. The path is usually: Start –> All Programs –> Administrative Tools –> Internet Service Manager (IIS) Manager.
- Expand the “Web site” directory and select the icon for your website. For example, if you are using the “Default Web Site” for WordPress you would choose this icon.
- Right-click the icon and select “Properties” from the context menu.
- Click the “ISAPI Filters” tab and then click the “Add” button.
- Choose a name for the ISAPI filter and type it in the “Filter name” field.
- Click “Browse” and select the ISAPI filter (wp-url-rewriting.dll) that you copied into the directory in step 2.
- Click “OK.”
Before clicking “OK” to close the “properties” dialog box, look under the “Status” column and make sure there is a green arrow pointing upward. If you see the green arrow this indicates the filter is working properly so you can click “OK” to close the dialog box. If you do not see the green arrow simply stop and then start the IIS ADMIN service using the command line or navigating to Start –> All Programs –> Administrative Tools –> Services. Select “IIS Admin” from the list of services and follow the instructions to stop and start the service.
- Login to the Admin panel and navigate to Options –> Permalinks.
- Choose the permalink structure of your choice and then remove “index.php” from the “Custom Structure.” The new structure will look like this:
- Save your changes and enjoy your Pretty Permalinks.