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

Example: Image blocking


In this example, we want to block all hot links from other websites to images served by our webserver. In particular, we will block all the files in http://www.domain.com/images/ and also all .jpg, .jpeg, and .gif files anywhere else in this webserver. We will use the "Referer" HTTP header as criterion for blocking those images which must not contain our webserver's domain "domain.com".


#Turn IIS Mod-Rewrite engine on
RewriteEngine On

#Check if Referer HTTP header does not contain "domain.com"...
RewriteCond %{HTTP_REFERER} !domain.com [NC]
#...and if so, send a Forbidden HTTP header for every image file
RewriteRule ^/images/.*|.+\.(gif|jpeg|jpg)$ - [F]
Download and try
IIS Mod-Rewrite

IIS rewrite

Download IIS Mod-Rewrite

Purchase IIS Mod-Rewrite