With URL Rewrite Module in IIS 7 Microsoft Windows, you can easy to make the WordPress Permalinks nicer and optimize for Search Engine Friendly URL. Before, WordPress which is hosted on IIS typically start with “index.php” in the Permalinks, ex: http://4rapiddev.com/index.php/category-name/post-name/ but nowadays, it’s easier for us to make the Permalinks more pretty (without the index.php) exactly the same with using .htaccess in Apache. The configuration makes your URLs a little bit shorter and more professional.
Firstly, make sure that you have completed the install PHP on IIS 7 with FastCGI module.
After that, download and install the latest stable version of WordPress. I assume that you completely understand and follow all steps to make your WordPress up and running on your IIS.
Below is the main part:
1. Update Permalinks settings
- Login to the Site Admin as an Administrator
- On Settings section, click on Permalinks tab
- On the Permalink Settings page, select Custom Structure option under Common settings and type: /%category%/%postname%/
- Click Save Changes button
Hand on, it has not finished yet, please continue to step 2.
2. Create Rewrite Rule in Web.config file
Firstly, you need to download & install the URL Rewrite module on the IIS:
- Download the x86 version of the URL Rewrite module
- Download the x64 version of the URL Rewrite module
After that, let create a Web.config file in the WordPress folder, if it’s not existed then copy and paste the XML settings below:
[xml]<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\php_536\php-cgi.exe" resourceType="Unspecified" />
</handlers>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Note: it’s copied from my environment, please update the scriptProcessor value with the location of php-cgi.exe file.