Skip to content

Instantly share code, notes, and snippets.

@jsheely
Last active August 31, 2017 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save jsheely/5949562 to your computer and use it in GitHub Desktop.
Save jsheely/5949562 to your computer and use it in GitHub Desktop.
IIS Url ReWrite rule to remove .aspx extension
<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" />
</conditions>
<action type="Rewrite" url="{R:1}.aspx" />
</rule>
@arnonuem
Copy link

This actually seem to add aspx instead of removing it.

How about this one?

<rule name="RemoveASPX" enabled="true" stopProcessing="true">
    <match url="(.*)\.aspx" />
    <action type="Redirect" url="{R:1}" />
</rule>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment