Helicon ISAPI REWRITE – Handle Domain Specific Rewrite Rules
ISAPI REWRITE: Domain Specific Rules
If you would like to setup rules depending upon the domain then this is the way best way to implement. This is very useful when multi websites are using same physical folder and the contents of all the sites are stored in the database.
There are two domains here www.abc.co.uk and www.xyz.co.uk which are pointing to the same .htaccess file.
Please follow the following steps to implement
STEP-1: Create .htaccess file with the following content
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.72
RewriteEngine on
RewriteBase /
RewriteMap mapfile1 txt:ABC.txt
RewriteCond ${mapfile1:$1|NOT_FOUND} !NOT_FOUND
RewriteCond %{HTTP_HOST} ^www\.abc \.co\.uk* [NC]
RewriteRule ([^?]+\.(?:html|aspx|htm|asp|xml)) ${mapfile1:$1} [NC,R=301,L]
RewriteMap mapfile2 txt:xyz.txt
RewriteCond ${mapfile2:$1|NOT_FOUND} !NOT_FOUND
RewriteCond %{HTTP_HOST} ^www\.xyz\.co\.uk* [NC]
RewriteRule ([^?]+\.(?:html|aspx|htm|asp|xml)) ${mapfile2:$1} [NC,R=301,L]
STEP-2: Create two files abc.txt and xyz.txt in the root folder.
Please put the below content in the abc.txt and save it.
about.html /new-abc-aboutus.html
product.html /new-abc-product.html
aboutids.html http://www.idslogic.com/
Please put the below content in the xyz.txt and save it.
about.html /new-xyz-aboutus.html
product.html /new-xyz-product.html
ids.html http://www.idslogic.com/
Now you run www.abc.co.uk /about.html in the browser then you can see it is redirecting to the www.abc.co.uk/new-abc-aboutus.html
and simillary if you run www.xyz.co.uk/about.html then you can see it is redirecting to the www.xyz.co.uk/new-xyz-product.html
I hope, this information has helped you. If you have any query please drop an email to nm@idslogic.com
Kind Regards
Narayan Mohapatra




