|
Home > Archive > IIS ASP > April 2005 > redirection on a shared server?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
redirection on a shared server?
|
|
|
| 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
| |
| Evertjan. 2005-04-18, 5:53 pm |
| 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.
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
| |
|
| Thank you for the sample code. I'll work with that and see what I can do.
Paul
"Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
news:Xns963CCC4353F74eejj99@194.109.133.29...
> Paul wrote on 18 apr 2005 in microsoft.public.inetserver.asp.general:
>
>
> 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.
>
> --
> Evertjan.
> The Netherlands.
> (Replace all crosses with dots in my emailaddress)
>
|
|
|
|
|