By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,053 Members | 922 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,053 IT Pros & Developers. It's quick & easy.

Reading al URL information for redirect

P: n/a
Hi there,
I have a number of domain names and they all point to the same IP address. I
would like to redirect to a specific folder, based on the domain name used
to access the site.
For example. www.root.com - points to the main default page.
www.otherroot.com would need to use the default page in a specified folder.

My ISP is not able to help here by allocating new IP addresses to the
subfolders of the main site. Something to do with the way IIS works. I have
a huge amounts of flash animations (some 200 meg) that need to be served up
and I do not want to have to duplicate them in other folders.

Is there a way in ASP to code the root default page to redirect based on the
URL?

Any assistance would be of great help.

Thanks
Hans
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hans wrote on 16 mrt 2004 in microsoft.public.inetserver.asp.general:
Hi there,
I have a number of domain names and they all point to the same IP
address. I would like to redirect to a specific folder, based on the
domain name used to access the site.
For example. www.root.com - points to the main default page.
www.otherroot.com would need to use the default page in a specified
folder.

My ISP is not able to help here by allocating new IP addresses to the
subfolders of the main site. Something to do with the way IIS works. I
have a huge amounts of flash animations (some 200 meg) that need to be
served up and I do not want to have to duplicate them in other
folders.

Is there a way in ASP to code the root default page to redirect based
on the URL?

start your 404.asp file with:

<%
qstr = lcase(Request.ServerVariables("QUERY_STRING"))

transferToDir("mySite.com", "mysitedirs")
transferToDir("123.123.123.123", "yoursitedirs")
transferToDir("hisSite.com", "hissite/dirs")

function transferToDir(from,to)
from1 = "404;http://" & from & ":80"
if instr(qstr,from1)<>1 then exit function

frol1len = len(from1)
server.transfer "/" & to & mid(qstr,from1len)
end function
%>

NOT TESTED, just the idea!!!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2

P: n/a
Hi Evertjan,

Thanks but I cannot access the 404.asp page. I am hosted on a shared server
and would like to code the header of the index.asp page of the site with
something that will redirect based on the URL entered.
I am not that clued up with scripting and not sure how to determine what the
URL content would be.

I tried experimenting with your sample code and still could not get the URL
that was entered to open the site.

Thanks
Hans

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Hans wrote on 16 mrt 2004 in microsoft.public.inetserver.asp.general:
Hi there,
I have a number of domain names and they all point to the same IP
address. I would like to redirect to a specific folder, based on the
domain name used to access the site.
For example. www.root.com - points to the main default page.
www.otherroot.com would need to use the default page in a specified
folder.

My ISP is not able to help here by allocating new IP addresses to the
subfolders of the main site. Something to do with the way IIS works. I
have a huge amounts of flash animations (some 200 meg) that need to be
served up and I do not want to have to duplicate them in other
folders.

Is there a way in ASP to code the root default page to redirect based
on the URL?

start your 404.asp file with:

<%
qstr = lcase(Request.ServerVariables("QUERY_STRING"))

transferToDir("mySite.com", "mysitedirs")
transferToDir("123.123.123.123", "yoursitedirs")
transferToDir("hisSite.com", "hissite/dirs")

function transferToDir(from,to)
from1 = "404;http://" & from & ":80"
if instr(qstr,from1)<>1 then exit function

frol1len = len(from1)
server.transfer "/" & to & mid(qstr,from1len)
end function
%>

NOT TESTED, just the idea!!!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 19 '05 #3

P: n/a
Hans wrote on 16 mrt 2004 in microsoft.public.inetserver.asp.general:
Thanks but I cannot access the 404.asp page. I am hosted on a shared
server and would like to code the header of the index.asp page of the
site with something that will redirect based on the URL entered.
I am not that clued up with scripting and not sure how to determine
what the URL content would be.


[please do not toppost on usenet]

That is the second possiblity, to include a smaal file at the top of each
asp file. However the non asp files like .jpg will be common.

<%
host = lcase(Request.ServerVariables("HTTP_HOST"))

transferToDir("mySite.com", "/mysitedirs")
transferToDir("123.123.123.123", "/yoursitedirs")
transferToDir("hisSite.com", "/hissite/dirs")

function transferToDir(from,to)
if instr(host,from1)<>1 then exit function
server.transfer to & Request.ServerVariables("URL")
end function
%>

also NOT TESTED, just the idea!!!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.