    '**************************************
    ' Name: Host Multiple sites on XP Pro, d
    '     omain redirects
    ' Description:Originally this was writte
    '     n because I wanted to host multiple site
    '     s on my laptop (for development purposes
    '     ), but XP pro doesn't allow a user to cr
    '     eate mutiple sites. So this script takes
    '     in a URL and redirects to the appropriat
    '     e site specified in a simple text file. 
    '     ie: www.yoursite.com can be redirected t
    '     o www.someothersite.com/yoursite
    the 2nd purpose of this script (unintentional but very useful) is To redirect based on properties of a URL. Our server has imail running on it, and the webmail requires users to Goto http://www.somesite.com:8383 to log-in. This script allows users to goto http://mail.somesite.com and be auto-redirected. It also allows any usernames to be auto-redirected to the appropriate folder (ie someuser.somesite.com can be redirected to www.somesite.com/someuser), etc etc
    Additionally, if this script is Set as the 404 handler (or incorporated into it), URLs like www.yoursite.com/somesite.asp can be redirected to www.somesite.com/yoursite/somesite.asp
    ' By: Mark Kahn
    '
    ' Inputs:None, set the file name as 'def
    '     ault.asp' (or whatever your default page
    '     name is set to) in your root directory.
    '
    ' Returns:redirects to the approrpiate p
    '     age.
    '
    ' Assumes:there are two files in the cod
    '     e below. you need to seperate them.
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/vb/scripts/Sho
    '     wCode.asp?txtCodeId=8394&lngWId=4    'for details.    '**************************************
    
    <%
    ' DEFAULT.ASP FILE!!!
    ' settings
    SendMail		= False						' send administrative alert With Each 404 Error
    AdminEmail	= "cwolves@cwolves.com"	' administrative e-mail address
    SiteRedir	= True						' Use "Site Redirection" feature (for IIS servers that only allow one site)
    RedirFile	= "E:\root\WebData\SiteDirectories.txt"	' Site Redirection Config File
    ' Site Redirection Script
    ServerURL			= request.servervariables("SERVER_NAME")
    Set RegEx			= New RegExp
    Set FSO				= server.createobject("Scripting.FileSystemObject")
    Set CFile			= FSO.OpenTextFile(RedirFile)
    RegEx.IgnoreCase	= True
    RegEx.Global		= False
    Directory			= ""
    DefaultPage			= ""
    'if lcase(left(ServerUrl, 5)) = "mail." 
    '     then response.redirect "http://" & Serve
    '     rUrl & ":8383"
    Do While Not CFile.AtEndOfStream
    	This				= CFile.ReadLine
    	if left(this, 1) <> "#" and This <> "" Then
    		ThisLine			= split(This, chr(9))
    		RegEx.Pattern	= ThisLine(0)
    		if RegEx.Test(ServerURL) Then
    			Directory	= RegEx.replace(ServerURL, ThisLine(1))
    			DefaultPage	= ThisLine(2)
    			Exit Do
    		End if
    	End if
    loop
    URL	= ""
    if Directory <> "" Then
    	if URL	= "" Then URL	= DefaultPage
    	Redir	= Directory & "/" & URL
    	response.redirect Redir
    End if
    %>
    ' SITEDIRECTORIES.TXT FILE! CREATE THIS 
    '     AS A SEPERATE FILE AND TELL DEFAULT.ASP 
    '     WHERE THAT FILE IS (RedirFile=... line).
    '     PLEASE CHANGE THE BELOW CODE TO SUIT YOU
    '     R OWN NEEDS. This is a tab-delimted text
    '     file. lines beginning with # are ignored
    '     . the first value is the domain name to 
    '     match. the 2nd value is the url to redir
    '     ect to, and the 3rd value is the default
    '     page to redirect to (used if no page is 
    '     specified, ie if the user goes to www.so
    '     mesite.com vs www.somesite.com/index.asp
    '     )
    # Regular Expression For Domain	Path	Default Page
    (mail\.[^\\]+)\/*	http://$1:8383	
    (admin\.[^\\]+)\/*	https://$1:8098	
    (sharepoint\.[^\\]+)\/*	http://$1:25764	
    mysql.cwolves.com	http://www.cwolves.com/phpmyadmin	index.php
    photos.cwolves.com	http://www.cwolves.com/photogallery	index.php
    .*Arathreel\.com	http://www.arathreel.com	artwork.asp
    .*CWolves\.com	http://www.cwolves.com	home.asp
    .*Webattempts\.com	http://www.webattempts.com	index.asp
    .*Rebent\.com	http://www.rebent.com	default.asp
    .*	http://www.webattempts.com	index.asp