除非登录

时间:2015-12-22 19:18:28

标签: php wordpress iis url-rewriting

我的wordpress安装在我的主网站的子文件夹中(使用ASP.NET构建):http://example.com/Blog

我在Blog目录中设置了一个重写规则,它加载了wordpress页面,而不需要URL中的“index.php”:

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

使用此重写规则,我的博客加载http://example.com/Blog,并且不需要像http://example.com/Blog/index.php那样使用index.php。个别帖子也会加载http://example.com/Blog/postname,而不是加载http://example.com/Blog/index.php/postname

问题是以上只有在我登录wp-admin时才有效(我特别相信,如果有“wordpress-logged-in”cookie)。否则,http://example.com/Blog将返回一个空白页面(无错误 - HTTP响应200)。

我对此感到非常困惑 - 为什么要登录或者cookie会对此产生影响?

这可能是个错误吗?我该如何解决这个问题?

0 个答案:

没有答案