1
votes

I have a site that has a number of aspx pages.

I recently added a wordpress blog on the root all working..

Now im trying to change the permalinks to get rid of index.php in the posts.

Rewrite 2.0 , Fast CGI, PHP 5

I added this code my web.config file and wordpress worked perfectly with pretty permalinks :

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

Now my aspx pages that use rewrite aswell are failing to load giving me a 404...Once i remove the above code from the web.config aspx pages are all ok!

Anyone with any ideas how to make this work?

Thanks

1

1 Answers

0
votes

I would suggest trying:

<system.webServer>
  <rewrite>
    <rules>
        <rule name="wordpress" patternSyntax="Wildcard">
            <match url="*.aspx" negate="true" />
                <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>

This should send everything except .aspx requests to index.php which I believe is what your trying to achieve here. The key change is:

match url="*.aspx" negate="true"