swaggerking
asked on
Script ASP to PHP
I need help converting the attached code from ASP to PHP for an internal site. I don't know PHP and the online ASP to PHP converters I found don't seem to be doing the job. 301 Redirects are not an option.
Basically I'm trying to find servers domain name, then check the string to see if I contains the older domain name, if so I want to replace the older domain name and redirect.
Example:
http://www.oldsite.com/somepage
redirect to
http://www.newsite.com/somepage
Basically I'm trying to find servers domain name, then check the string to see if I contains the older domain name, if so I want to replace the older domain name and redirect.
Example:
http://www.oldsite.com/somepage
redirect to
http://www.newsite.com/somepage
<%
Thispage ="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL")
If Instr(ThisPage, "oldsite.com") Then
Thispage = Replace(Thispage, "oldsite.com", "newsite.com")
response.redirect (ThisPage)
End If
%>
ASKER
Hey hielo.
Unfortunately it's not redirecting.
Unfortunately it's not redirecting.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Much appreciation. It worked.
Open in new window