Home > Web > More ASP Tips

More ASP Tips

September 10th, 2007
Comments Off

Lately I have needed to perform a lot of redirects from old pages to new pages. Some of these old pages have decent rankings in search engines, so how do I make sure these new pages retain this ranking? By using a HTTP 301 Redirect (HTTP Moved Permanently). Here is how you code a 301 redirect in ASP:


<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "/newer-page.asp"
%>

If you are wanting to redirect to your default page name (index.asp,default.asp etc.), it is a good idea to redirect only to the folder name and leave off the name of the page like:


<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "/subfolder/"
%>

Web ,