redirection on a shared server?

P

Paul

I am setting up 4 sites for a small business complex. They wanted to save
money on hosting so asked to have all the sites under one hosting plan, but
with independent domain names. I thought that would be easy, just set up a
domain redirect to a specific folder on the server. Unfortunately I have
since learned that the host does not provide that level of redirection.

Let's say my 4 sites are: restaurant.com, coffeeshop.com, dayspa.com and
bizcomplex.com. The hosting account is set up for bizcomplex.com, and the
other 3 domains are redirected to it. I have set up a folder for each site
on bizcomplex.com's server. The actual URL for a file would be like www
..bizcomplex.com/restaurant/menu.html.

I have written a brief domain sniffer script in ASP that will detect if
someone types in "www. restaurant.com" and automatically move them to the
"restaurant/" folder. However, I can not see how to allow direct linking if
someone types in a complete URL, such as "www. restaurant.com/menu.html"

Any assistance you can provide would be appreciated.

Thank you.
Paul
 
E

Evertjan.

Paul wrote on 18 apr 2005 in microsoft.public.inetserver.asp.general:
I have written a brief domain sniffer script in ASP that will detect
if someone types in "www. restaurant.com" and automatically move them
to the "restaurant/" folder. However, I can not see how to allow
direct linking if someone types in a complete URL, such as "www.
restaurant.com/menu.html"

Make the below include in the top of all asp files.
other files [img etc] must be pointed to absolutely.

<%
snm = lcase(Request.ServerVariables("SERVER_NAME"))
scn = Request.ServerVariables("SCRIPT_NAME")
' allows www. and non www.

if instr(snm ,"restaurant.com")>0 Then
if instr(scn ,"/restaurant")=1 then
response.Redirect scn
end if
Response.Redirect "/restaurant" & scn
elseif instr(snm ,"hotel.com")>0 Then
if instr(scn ,"/hotel")=1 then
response.Redirect scn
end if
Response.Redirect "/hotel" & scn
else
' this file main domain
end if
%>

not tested

further you could test in a custom /404.asp
for files without "/restaurant" or "/hotel"
and redirect them with it.
 
P

Paul

Thank you for the sample code. I'll work with that and see what I can do.

Paul
Evertjan. said:
Paul wrote on 18 apr 2005 in microsoft.public.inetserver.asp.general:
I have written a brief domain sniffer script in ASP that will detect
if someone types in "www. restaurant.com" and automatically move them
to the "restaurant/" folder. However, I can not see how to allow
direct linking if someone types in a complete URL, such as "www.
restaurant.com/menu.html"

Make the below include in the top of all asp files.
other files [img etc] must be pointed to absolutely.

<%
snm = lcase(Request.ServerVariables("SERVER_NAME"))
scn = Request.ServerVariables("SCRIPT_NAME")
' allows www. and non www.

if instr(snm ,"restaurant.com")>0 Then
if instr(scn ,"/restaurant")=1 then
response.Redirect scn
end if
Response.Redirect "/restaurant" & scn
elseif instr(snm ,"hotel.com")>0 Then
if instr(scn ,"/hotel")=1 then
response.Redirect scn
end if
Response.Redirect "/hotel" & scn
else
' this file main domain
end if
%>

not tested

further you could test in a custom /404.asp
for files without "/restaurant" or "/hotel"
and redirect them with it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top