在安装完wordpress后,当我们打开文章后会发现网址是这样的http://domain.com/index.php/post-name/,里面总是会带有index.php这个后缀。如果我们想让网址静态化,也就是这样的http://domain.com/post-name/,那么我们就需要在在web.config文件内的<system.webServer>节点下添加以下配置。
<rewrite>
<rules>
<rule name="WordPress Url Static" 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>