ASP / ASP.NET 301 Redirects

Creating search engine friendly 301 redirects as part of your SEO initiatives is a great tip to keep under your belt.

If your website runs using Active Server Pages (ASP or ASP .NET) architecture, generating the redirect from the source code is probably your easiest and most efficient solution.

Search engines interpret the 301 code as meaning "moved permanently". In turn, PageRank/trust is passed from the old page to the new.

ShareThis

Example Code

ASP

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.new-domain.com/or-page.html"
%>

ASP .NET

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-domain.com/or-page.html");
}
</script>

This code should be placed before other data is sent to the browser.


blog comments powered by Disqus



Sponsors