How to handle redirects?

B

Brett Romero

I'm on a managed server, which is new to me. I don't have access to IIS.
The way it is setup, I have one main folder for a website. For example,
123.com will access this root folder. If I want to use another website,
such as myothersite.com, I have to use a redirect script, which sends users
to a sub folder. That turns the URL into myothersite.com/myothersite.com.

Currently, 123.com will go to a sub folder. I can change this so it goes
into the root and the URL looks like 123.com instead of 123.com/123.com.
But I can only have one domain in the root. So only one website will have a
normal appearing URL. All others have to be in sub folders and get the sub
folder name appended to their URL.

For this example, I have both sites going to sub folders. Here is the
script:

<%
dim serverName
serverName = request.ServerVariables("SERVER_NAME")
if inStr(1,serverName,"123.com",1)>0 then
response.Redirect("/123.com")
elseif inStr(1,serverName,"myothersite.com",1)>0 then
response.Redirect("/myothersite.com")
else
response.Write("You came to unknown domain. Please choose one of the
following:<br>")
response.Write("<a
href='http://www.123.com'>http://www.123.com</a><br>")
response.Write("<a
href='http://www.myothersite.com'>http://www.myothersite.com</a><br>")
end if
%>

Is there a way to have the URL of myothersite.com not append the folder name
and still redirect to the correct site? Or is this just to limited of a
setup?

[Please note, the domains I used are only for example. I do not own them.]

Thanks,
Brett
 

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

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top