I am trying to configure rewrite rules for a Wordpress MU 2.7 on IIS7 with PHP5 (fastcgi).
At the moment I only have the following rewrite rule in Web.config:
<rule name="Canonical Host Name" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" negate="true"
pattern="^subdomain\.example\.com$" />
</conditions>
<action type="Redirect"
url="http://subdomain.example.com/{R:1}"
redirectType="Permanent" />
</rule>
At the moment when I enter a URL (see below) it does redirect to the right hostname but for some reason prepends the path with a index.php/
:
url: `http://subdomain/my/path/123`
redirects to: `http://subdomain.example.com/index.php/my/path/123`
should redirect to: `http://subdomain.example.com/my/path/123`
Does anyone have an idea why this is and how I can prevent this from happening?
Am I missing a certain server setting or something...? php.ini? web.config rule? Or is it just my rewrite rule that's wrong?
Edit: This problem seems to have nothing to do with Wordpress's permalink structure! The behaviour is the same if I remove of redirect index.php
. I don't think any PHP code is running... this has to be at a higher level.
Wordpress, by default (I think), formats friendly permalinks as index.php/path/to/post, as this mimics rewriting without requiring the server to support rewriting. That would explain why your rewrites are that way - they have the index.php in them before being rewritten.
您可以通过在WordPress配置中更改“永久链接”结构选项来防止发生这种情况。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.