IIS Mod-Rewrite examples
Overview Documentation Download Purchase FAQ  
IIS Mod-Rewrite - URL rewrite tool for IIS

Example: Change filename extension on the fly

Scenario:

In this example, we assume that we have an entire website written in PHP. However, we are planning to change the web engine from PHP to ASP sometime soon. But we don't want to change all the URLs from "/blah/blah.php" to "/blah/blah.asp" because this will cost a lot of programming hours, it is error prone, and more importantly it will have a negative impact to the website's pagerank. Instead, we choose all the urls to have a ".html" extension, and IIS Mod-Rewrite will convert the extension to the current webengine's extension (.php or .asp).

Configuration 1:
Convert from .html to .php


#Turn IIS Mod-Rewrite engine on
RewriteEngine On

#Extract the filename body and add the .php extension
RewriteRule ^/(.+)\.html$ /$1.php [L,QSA]


Configuration 2:
Convert from .html to .asp


#Turn IIS Mod-Rewrite engine on
RewriteEngine On

#Extract the filename body and add the .asp extension
RewriteRule ^/(.+)\.html$ /$1.asp [L,QSA]
 
Download and try
IIS Mod-Rewrite
NOW!


IIS rewrite

Download IIS Mod-Rewrite

Purchase IIS Mod-Rewrite