MarySunshine
10-28-2003, 06:33 PM
I use this code in an ASP file on another server to redirect domains to various files/directories. I want to do the same thing in PHP. I have done a search on "PHP redirect" and have found all kinds of stuff but NOT what I am looking for. :confused: Can anyone help me here?
This is the script:
<%
dim serverName
serverName = request.ServerVariables("SERVER_NAME")
if inStr(1,serverName,"domain1.com",1)>0 then
response.Redirect("/domain1")
elseif inStr(1,serverName,"domain2.com",1)>0 then
response.Redirect("/domain2")
elseif inStr(1,serverName,"domain3.com",1)>0 then
response.Redirect("/domain3")
elseif inStr(1,serverName,"domain4",1)>0 then
response.Redirect("welcome.htm")
else
response.Write("You came to unknown domain. Please choose one of the following:<br>")
response.Write("<a href='http://www.domain1.com'>http://www.domain1.com</a><br>")
response.Write("<a href='http://www.domain2.com'>http://www.domain2.com</a><br>")
response.Write("<a href='http://www.domain3.com'>http://www.domain3.com</a><br>")
response.Write("<a href='http://www.domain4.com'>http://www.domain4.com</a><br>")
end if
%>
This is the script:
<%
dim serverName
serverName = request.ServerVariables("SERVER_NAME")
if inStr(1,serverName,"domain1.com",1)>0 then
response.Redirect("/domain1")
elseif inStr(1,serverName,"domain2.com",1)>0 then
response.Redirect("/domain2")
elseif inStr(1,serverName,"domain3.com",1)>0 then
response.Redirect("/domain3")
elseif inStr(1,serverName,"domain4",1)>0 then
response.Redirect("welcome.htm")
else
response.Write("You came to unknown domain. Please choose one of the following:<br>")
response.Write("<a href='http://www.domain1.com'>http://www.domain1.com</a><br>")
response.Write("<a href='http://www.domain2.com'>http://www.domain2.com</a><br>")
response.Write("<a href='http://www.domain3.com'>http://www.domain3.com</a><br>")
response.Write("<a href='http://www.domain4.com'>http://www.domain4.com</a><br>")
end if
%>