This sample script shows how to direct visitors to a specified folder or file using
ASP based on the domain name the visitor entered in their web browser. The script will read the domain requested by the site visitor and then
direct that visitor to a specific folder or file. This script is best used as a
site's index page (index.asp).
<%
Dim Host
dim ServerDir
dim
PageURL
Dim contentsWidth, newsWidth
host = lcase
(request.servervariables("SERVER_NAME"))
serverDir = ""
SELECT CASE
host
'this example directs the domains
www.apple.com and apple.com to a folder called
/apple
CASE "
www.apple.com"
serverdir="/apple"
CASE
"apple.com"
serverdir="/apple"
'this example directs the domains
www.orange.com and orange.com to a file called
orange.htm
CASE "
www.orange.com"
serverdir="orange.htm"
CASE
"orange.com"
serverdir="orange.htm"
'this example directs all other
domains and IP addresses to a folder called /main
CASE
else
serverdir="/main"
end SELECT
response.redirect
serverDir
%>