ASP 301 SEO Redirect - Cheat Sheet



Server side ASP script for 301 SEO Permanent Redirect

<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”;
Response.AddHeader("Location”,”URL of the new page ");
%>

Best Practice - Create a file Redirect.asp

<%
Domain_Name = lcase(request.ServerVariables("HTTP_HOST"))
if domain_name <> "www.freemanortho.com" Then
HTTP_PATH = request.ServerVariables("PATH_INFO")
QUERY_STRING = request.ServerVariables("QUERY_STRING")
theURL = "http://www.freemanortho.com" & HTTP_PATH
if len(QUERY_STRING) > 0 Then
theURL = theURL & "?" & QUERY_STRING
end if
Response.Clear
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", theURL
Response.Flush
Response.End
end if
%>

Include this file in the include file in the header.asp

 <!-- #Include file="redirect.asp" --> 

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.