WordPress url rewriting does not work on iis7

I have a WordPress website running on IIS7.

I had a big problem because all my url except the home page contain index.php.

Read More

My home page : www.mywebsite.com
Others : www.mywebsite.com/index.php/post1, www.mywebsite.com/index.php/post2 and so..

I’d like to use the url rewriting mode of IIS7. My web host told me that the rewriting module is activated.

I don’t know what to write in web.config file. I’ve tried :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <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>
    </system.webServer>
</configuration>

My url does not change !

and this :

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Supprimer index.php">
                    <match url="^index.php/([_0-9a-z-]+)/([_0-9a-z-]+)" />
                    <action type="Rewrite" url="{R:1}/{R:2}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

I’ve also tried:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Main Rule" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:0}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Always does not work.

Could you help me to remove index.php in the url please ?

Related posts

Leave a Reply

1 comment

  1. <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <httpErrors errorMode="Detailed"/>
        <rewrite>
          <rules>
            <rule name="Main Rule" stopProcessing="true">
            <match url=".*"/>
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
            <action type="Rewrite" url="index.php/{R:0}"/></rule>
                <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>
        <defaultDocument>
          <files>
            <clear/>
    
            <add value="index.php"/>
          </files>
        </defaultDocument>
      </system.webServer>
    </configuration>