【问题标题】:Wordpress subpages give 404 in windows subdirectory installationWordpress子页面在windows子目录安装中给出404
【发布时间】:2020-09-29 13:52:10
【问题描述】:

我正在将一个站点从 linux 服务器迁移到 windows 服务器。该网站在 /blog 子文件夹中安装了 wordpress。 wordpress 网站的所有页面都给出了 404,除了主页。

我尝试将以下内容添加到域根目录中的 web.config 中:

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

因为这适用于以前的 windows wordpress 安装,但那些以前的安装是在域的根目录中,而不是在子目录中。

请帮忙。

【问题讨论】:

  • 这能回答你的问题吗? How to map or copy a wordpress site to a subfolder in an existing site's route?这个问题是针对子文件夹的,但对于子域来说,过程完全相同——这些答案中可能有一些帮助?
  • 不,它没有帮助。 wp 站点始终位于 /blog 子文件夹中。唯一改变的是整个域正在从 linux 服务器转移到 windows 服务器。因此不再使用 htaccess,我必须使用 web.config。

标签: wordpress web-config http-status-code-404 windows-server


【解决方案1】:

所以最后,我只需要将 web.config 文件和上面的 sn-p 放在我的 wp 安装所在的子文件夹中,并将其从域的根目录中删除。我之前只做了前者,没有后者。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-10-14
    • 2017-05-19
    • 2013-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-31
    相关资源
    最近更新 更多