How do I create domain Redirects w/ ISAPI_Rewrite?

Applied Innovations includes a utility installed on the servers called ISAPI_ReWrite. It's a way to manipulate URL's by using rules / directives (regular expressions) for your website. 

 

It sounds and looks complicated at first, but something like domain redirects are fairly simple once you know what the syntax looks like and how to implement it.  There's really only a little bit of information in the "rule" that needs to be edited.

Basic Steps:

1. Create a file called .htaccess using Notepad (save as "All File Types")   (Note -  ISAPI rewrite version 3 requires the file named .htaccess,  and version 2 requires the file named httpd.ini)
2. Enter the appropriate rules
3. Save the file and place into your /wwwroot folder (content root folder)


This is what the "rules" for a domain redirect example would look like:


Example: you have registered two domains www.site1.com and www.site2.com. Now you can create what appears to be two different sites using single physical hosting site. Add the following rules to your httpd.ini file:


[ISAPI_Rewrite]

RewriteCond Host: (www\.)?site1\.com
RewriteRule (.*) /site1$2

RewriteCond Host: (www\.)?site2\.com
RewriteRule (.*) /site2$2
 
In the above example - /site1$2 - site1 is the folder name with the contents of site name #1 -- same goes for /site2$2. Granted, depending on how you set up the domain you may only have to use one rule. The above example assumes you placed the content for each site in unique folders. This may be the case if you designed the site in mind from the beginning for this purpose, but not if you're taking an existing site and adding another one within it.

 


Another Example:

You may have created the site normally with all of the "original" (site1) contents in the /wwwroot folder as would be the case for most users. You then decide you want another domain name added and have it "masked" to appear as if it's an entirely separate domain.

You make a folder called /site2 and place the contents of that site in this folder. In this particular case you only need one rule:

RewriteCond Host: (www\.)?site2\.com
RewriteRule (.*) /site2$2

Anything directed to go to the "original" site is going to the specified default document in /wwwroot. Anything caught by the above rule will be sent to the /site2 folder and again picked up by the default document setting. You can further refine the rule by adding specific pages, however this can also be achieved through the default documents setting in our control panel.

Example:

RewriteCond Host: (www\.)?site2\.com
RewriteRule (.*) /site2$2/index.html

* Follow the syntax closely! 

Please email support or visit the official Helicon website forums for further assistance:


http://www.isapirewrite.com/forum/

ISAPI Rewrite Version 2 Documentation - http://www.isapirewrite.com/

ISAPI Rewrite Version 3 Documentation - http://www.helicontech.com/isapi_rewrite/


Add Feedback