This ASP redirect method allows you to pass along querystrings if you need to.
It fires back valid HTTP Status codes with "HTTP/ 1.1 200 OK"
*Caveat: To prevent hacking, It's a good idea to parse querystrings for illegal characters.
Check your headers:
Check Server Headers Tool - HTTP Status Codes Checker
Code:
<%@LANGUAGE="VBSCRIPT"%>
<%
'*****************************************
' 301 Redirect for non-www domain entries
'*****************************************
host = Request.ServerVariables("HTTP_HOST")
page = Request.Servervariables("URL")
pageData = Request.ServerVariables("QUERY_STRING")
'allow passing of querystrings to the redirected URL
if pageData <> "" Then
pageData = "?" & pageData
end if
'substitute yoursite.com for your own URL.
if host = "yoursite.com" then
host = "http://www.yoursite.com"
newUrl = host & page & pageData
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", newUrl
Response.End
end if
'*******************
' End 301 Redirect
%>