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

Example: Search engine friendly URLs


In this example, we assume that we have a database driven website that all its content is dynamicaly created by server side scripts. Our webpages have URLs such as "http://www.domain.com/content.csp?cat=cars&kind=bmw&model=z4".

Such URLs that use querystrings, usually are not crawled by search engines. We need to convert this URL to look like a static URL. So we need the clients to request the URL "http://www.domain.com/cont/cars/bmw/z4" and convert it to the real URL above. Also, it's necessary to serve content for locations like "/cont/cars/bmw" and "/cont/cars" too.


#Turn IIS Mod-Rewrite engine on
RewriteEngine On

#Split the friendly URL and compose the real URL
RewriteRule ^/cont/([^/]+)/?([^/]*)/?([^/]*)$ /content.csp?cat=$1&kind=$2&model=$3 [L]
Download and try
IIS Mod-Rewrite

IIS rewrite

Download IIS Mod-Rewrite

Purchase IIS Mod-Rewrite