首先, 要弄清楚网站所在的服务器是IIS还是Apache. Apache 上面应该不会有这样的问题。 因为mod_rewrite 在Apache是支持的, IIS 是不支持的。
WP自己有自己的伪静态规则去处理错误页面。很多主题都带有自带有404错误页面模板。但是当我们输入一个不存在的站内网址之后,浏览器中显示的错误是IIS级别的404错误提示。
这样的问题处理办法:
登陆WP admin Dashboard---> settings ---> permalinks.
这样做的结果就是在你的web.config 根目录下面加上以下 section:
<?xml
version="1.0"
encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule
name="WordPress"
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"
appendQueryString="true"
/> </rule> </rules> </rewrite> </system.webServer></configuration>如此, 你的WP就会开始通过IIS rewrite Module 来处理这样的问题了。
本文详细介绍了如何通过修改web.config文件,利用IIS rewrite模块解决WordPress网站内部链接不存在导致的404错误问题,具体包括在WordPress admin dashboard设置中调整permalinks,并在web.config中添加特定的rewrite section。
1018

被折叠的 条评论
为什么被折叠?



