Forum Moderators: open
However, is the following redirect procedure, which is recommended by my host, the best one?
My goal is to have no problem with spidering and to see my new url getting ranked.
----------
Using ASP code, you can detect which URL a person is browsing to your site with, and redirect them to the appropriate place on your site. Here is some example code that will do the job, put this at the very top of an .ASP page, before any HTTP tags:
<%
sname = Request.ServerVariables("SERVER_NAME")
sname = ucase(sname)
if InStr(sname,"DOMAIN1") <> 0 then
response.redirect "subdirectory to go to"
elseif InStr(sname,"DOMAIN2") <> 0 then
response.redirect "2nd subdirectory to go to"
elseif........
end if
Make sure that the domains in the InStr commands are capital letters. For example, suppose you have two domains, apple.com and banana.com, pointing to the same web site. On this site there is an "appledir" subdirectory (or sub-web) and a "bananadir" subdirectory. Then the code will look like this:
<%
sname = Request.ServerVariables("SERVER_NAME")
sname = ucase(sname)
if InStr(sname,"APPLE") <> 0 then
response.redirect "appledir"
elseif InStr(sname,"BANANA") <> 0 then
response.redirect "bananadir"
end if
If you have only two domains and you still need the primary domain to poin to the root of the site then you can use this code:
<%
sname = Request.ServerVariables("SERVER_NAME")
sname = ucase(sname)
if InStr(sname,"DOMAIN2") <> 0 then
response.redirect "domain"
else
response.redirect "index.html"
end if
To date google has not had a problem indexing my domains utilizing this structure.