Home
Atom Feed

Changing file type extensions with IIS 7

Some time after I released the Sitemap Generator Umbraco package, I realized that some search engines and SEO tools only looked for a file called "sitemap.xml".

My package only renders a "sitemap.aspx" file, so this had to be fixed. Rather than developing a control that changes the file extension of the .aspx file, I looked into URL Rewriting.

Note: This tutorial is originally designed for websites with the sitemap.aspx file in the root. I.e. /sitemap.aspx . You can also use this tutorial with other files or extensions.

First, make sure you have installed the URL Rewrite 2.0 extension for IIS 7.x.

Then go to your site in the IIS Manager and click on "URL Rewrite".

Then click "Add Rule(s)" in the upper right corner and select "Blank Rule".

Now fill in the information in the picture below:

Pattern: ^(.*)sitemap.xml
Rewrite Url: {R:1}sitemap.aspx

Now you can test it by navigating to http://your.url/sitemap.xml.

See it in action here: /sitemap.xml