using rewrite and wordpress permalinks

I have a site that uses and wordpress. The wordpress component is in a sub-directory called wordpress. It uses permalinks.

I also have an site that uses the site root directory as ist top level diretory.

The site uses some rewrite rules so i can access the .aspx pages without the .aspx extension. Effectively it adds .aspx to the page. This is the rewrite rules in the web.config file

    <rule name="san aspx">
      <!--Removes the .aspx extension for all pages.-->
      <match url="(.*)" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_FILENAME}" pattern="/*.png" negate="true" />
        <add input="{REQUEST_FILENAME}" pattern="/*.php" negate="true" />
        <add input="{REQUEST_FILENAME}" pattern="/wordpress/*.php" negate="true" />
        <add input="{REQUEST_FILENAME}" pattern="/webservice/*.asmx" negate="true" />
      <action type="Rewrite" url="{R:1}.aspx" />

this works fine for the pages.

However it also adds the .aspx extension to the wordpress pages. So if I have a page (displayed as a permalink) such as


it looks for a page called


If I turn OFF permalinks, the wordpress pages display correctly because the rewrite rule

<add input="{REQUEST_FILENAME}" pattern="/*.php" negate="true" />

correctly identifies the .php page and ignores the rewrite.

Question: what extra condition do I need in the rewrite rules so it does NOT add .aspx to a wordpress permalink.

Read more here: using rewrite and wordpress permalinks

Leave a Reply

Your email address will not be published. Required fields are marked *