ASP and 30x redirects for SEO
One of the common things I come across when building websites is the lack of understanding for SEO when you are porting to a new site.
One recent site I've just finished meant porting a site from classic ASP 3.0 to ASP.net and how to point redirects to the new pages to maintain the SEO rankings. Well the obvious answer is a 301 redirect. But how?
Well there are many ways on an IIS box but the basic way to point ASP (classic) pages is to have a global.asa AS WELL AS a global.asax. The global.asa will serve ASP (classic) and the global.asax will serve the ASP.net pages... Therefore we can simply put our redirect code into the global.asa and point our .asp files to their new .aspx conterparts...
If Request.ServerVariables("PATH_INFO")= "/default.asp" Then
If Request.ServerVariables("QUERY_STRING")="" Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.mydomain.com/"
Else
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.mydomain.com/?" &
Request.ServerVariables("QUERY_STRING")
End If
End if
I've added the check for querystring variables in case you wanted to pass any tracking or like URL variables to your new page but you can customise to suit your needs.
One recent site I've just finished meant porting a site from classic ASP 3.0 to ASP.net and how to point redirects to the new pages to maintain the SEO rankings. Well the obvious answer is a 301 redirect. But how?
Well there are many ways on an IIS box but the basic way to point ASP (classic) pages is to have a global.asa AS WELL AS a global.asax. The global.asa will serve ASP (classic) and the global.asax will serve the ASP.net pages... Therefore we can simply put our redirect code into the global.asa and point our .asp files to their new .aspx conterparts...
If Request.ServerVariables("PATH_INFO")= "/default.asp" Then
If Request.ServerVariables("QUERY_STRING")="" Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.mydomain.com/"
Else
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.mydomain.com/?" &
Request.ServerVariables("QUERY_STRING")
End If
End if
I've added the check for querystring variables in case you wanted to pass any tracking or like URL variables to your new page but you can customise to suit your needs.




