[SOLVED] Remove HTML or ASPX Extension


In a hosted IIS7 environment, I am looking for the simplest way to use extension-less file names. Simply I have the following pages:

index.html (or .aspx) –> domain.com
gallery.html –> domain.com/gallery
videos.html –> domain.com/videos

I only have a handful of pages, I have no dynamic code, nothing special. All the examples I have found or methods I use in other sites I’ve developed revolve around dynamic content, pages, etc. I am simply looking for the simplest solution, ideally not requiring any sort of url rewrite module installed. Preferably, I could keep the .html extension instead of converting the site to a ASP.NET project, but that is an option.



I ended up using the following sites:




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

            <rule name="RewriteASPX">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                <action type="Rewrite" url="{R:1}.aspx" />

Answered By – roadsunknown

Answer Checked By – Clifford M. (BugsFixing Volunteer)

Leave a Reply

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