Posts Tagged IIS7
25Sep/092
WordPress on IIS7
How to use WordPress blog's permalinks with IIS7 (or similar Content Management Systems)?It's really simple to make this work on Apache server. Just copy 5 lines of code to .htaccess file.
But it's a little bit harder to do so on IIS7. You have 2 options:
- use IIS7 GUI to create rules
- modify Web.Config by hand
Code for Web.Config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteUserFriendlyURL1" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<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>
Explanation:
1. IIS tries to match requested url with * (everything).
2. If match is found, IIS checks if there is a file with the same url that is requested.
3. Then IIS checks if there is a directory with that name.
4. If there is no file/directory with that name, IIS rewrites url to "index.php".