views:

726

answers:

2

Hi,

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.

+1  A: 

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.

adam
I don't think any php code (wordpress) runs. If I remove/rename index.php I still have the same problem. Besides that the permalink structure is already set to a version without "index.php" in the path...
Ben
A: 

You can prevent it from happening by changing the Permalink structure option in your WordPress config.

great_llama
This was my first thought as well but it seems to be at a higher level... the permalink structure is already set to a version without /index.php in the path.
Ben