Remove HTML or ASPX Extension

I ended up using the following sites:

http://blogs.msdn.com/b/carlosag/archive/2008/09/02/iis7urlrewriteseo.aspx

and

http://forums.iis.net/t/1162450.aspx

or basically the following code in my web.config file using the IIS7 URL Rewrite Module that most hosted sites now offer (in this case I am using GoDaddy):

<system.webServer>
    <rewrite>
        <rules>
            <rule name="RewriteASPX">
                <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>
        </rules>
    </rewrite>
</system.webServer>

Leave a Comment