【问题标题】:404 for custom post link on IIS with URL Rewrite Module带有 URL 重写模块的 IIS 上的自定义发布链接的 404
【发布时间】:2021-10-20 17:49:27
【问题描述】:

我需要使用 IIS 来开发新的 WordPress 网站。看了很多文章,在IIS上安装了URL Rewrite Module (https://www.iis.net/downloads/microsoft/url-rewrite)。

我的网站结构是: 本地主机/项目名称/projectcms/

我将 cms 上的 WordPress URL 设置为: http://localhost/projectname/projectcms

wordpress 安装在 projectcms 文件夹中。

网站网址为: http://localhost/项目名称

另外,我将帖子链接自定义为: http://localhost/projectname/% category%/%year%/%postname%/

(“%”和“c”之间没有空格)

但是,这些页面显示 404 错误。

为了使这些链接正常工作,我需要在 URL 重写模块上设置什么重写规则?

【问题讨论】:

    标签: php wordpress windows iis url-rewriting


    【解决方案1】:

    你想从http://localhost/projectname重定向到http://localhost/projectname/% category%/%year%/%postname%/吗?如果是这样,你可以试试这个规则:

    <rule name="test" enabled="false" stopProcessing="true">
        <match url="^projectname$" />           
        <action type="Redirect" url="http://localhost/projectname/% category%/%year%/%postname%/" />
    </rule>
    

    【讨论】:

      猜你喜欢
      • 2011-08-16
      • 1970-01-01
      • 1970-01-01
      • 2012-08-29
      • 2013-01-01
      • 1970-01-01
      • 2013-04-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多