【发布时间】:2019-08-02 15:16:02
【问题描述】:
我已经在我的个人计算机上使用 IIS 设置了 wordpress,当我访问无效页面而不是得到 Wordpress 404 错误页面时,我得到 IIS 默认 404 错误页面。有没有办法让 IIS 服务器使用 Wordpress 的?
【问题讨论】:
我已经在我的个人计算机上使用 IIS 设置了 wordpress,当我访问无效页面而不是得到 Wordpress 404 错误页面时,我得到 IIS 默认 404 错误页面。有没有办法让 IIS 服务器使用 Wordpress 的?
【问题讨论】:
按照 Codex 中的建议 https://codex.wordpress.org/Creating_an_Error_404_Page,您只需将名为 404.php 的文件拖放到子主题的主目录中即可。
【讨论】:
确保有任何永久链接设置是问题所在。 使用 Web 平台安装程序在 IIS 中安装 Url 重写模块,如果未安装,则使用 manually。 在您的 web.config 文件中添加以下 url 重写规则。
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=“wordpress” patternSyntax=“Wildcard”>
<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>
在站点文件夹上为 IIS_IUSRS 和 IUSR 设置正确的文件权限。
重新启动 IIS 服务器。
【讨论】: