我在wordpress根文件夹中有静态php页面。在web.config文件中,我将默认文件更改为静态php文件home.php。我的网站上有很少的静态php页面和很少的wordpress页面。对于wordpress页面使用固定链接更改seo友好URL但静态php页面无法删除.php扩展
例如:http://reactore.com/contact-us/ --- wordpress页面 http://reactore.com/about-us.php ---静态php页面
这是我的web.config文件:
<rewrite>
<rules>
<rule name="WPurls" enabled="true" 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/{R:0}" />
</rule>
</rules>
</rewrite>
答案 0 :(得分:4)
在您的网络配置中使用此代码:
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}.php" matchType="IsFile" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="{R:1}.php" />
</rule>
</rules>
</rewrite>