WordPress rewrite rule / pages doesn’t work unless logged in

I have my wordpress installed in a subfolder of my main website (built with ASP.NET): http://example.com/Blog.

I have a rewrite rule set up in the Blog directory which loads the wordpress pages without requiring “index.php” in the URL:

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

With this rewrite rule, my blog loads at http://example.com/Blog, and there’s no need to use index.php like http://example.com/Blog/index.php. Individual posts also load with http://example.com/Blog/postname as opposed to only with http://example.com/Blog/index.php/postname.

The issue is that the above only works if I’m logged in to wp-admin (I believe specifically, if the “wordpress-logged-in” cookie is there). Otherwise, http://example.com/Blog returns a blank page (no error – HTTP response 200).

I am totally baffled by this – why would being logged in or a cookie have an effect on this?

Can this be a bug? How do I go about fixing this?

Related posts