【问题标题】:Wordpress displays page instead of 404 error without https prefixWordpress 显示页面而不是没有 https 前缀的 404 错误
【发布时间】:2019-06-28 01:21:45
【问题描述】:

当使用 www 时,我在 iis 上安装的 Wordpress 会显示特定页面而不是 404 来显示丢失的页面。没有 https:// 即:

https://www.mydomain.co.uk/cabbage 进入 404 错误页面

www.mydomain.co.uk/cabbage 转到我网站上的一个页面,如果我禁用此页面,它只会转到另一个页面,而不是 404 页面。

已尝试重新保存永久链接并禁用重定向插件。

【问题讨论】:

标签: wordpress iis http-status-code-404


【解决方案1】:

根据 WordPress 文档,如果您运行的是 IIS 7+,则还需要安装 URL Rewrite 1.1+ 模块。这是一个非常标准的模块,通常已经安装。

<?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>

如果您已经有 web.config 文件,只需添加缺少的标签,而不删除任何现有设置。

【讨论】:

  • 我检查了 web.config 文件,它包含您提供的行,但没有提及 www。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-09
  • 1970-01-01
  • 2019-03-17
  • 1970-01-01
  • 2023-03-04
  • 1970-01-01
相关资源
最近更新 更多