How to Redirecting URL with ASP

If you are utilizing .asp (Windows Active Server Pages) as the underlying technology of your Windows IIS hosted websites, there is a simple 301 permanent redirect method that you can utilize without involving a server administrator. This 301 method allows you to quickly implement a 301 Moved Permanently status from the old-page.asp to the new-page.asp. Here is how it works…

Take the old-page.asp that is being renamed or moved and remove all of the code. Place the below code in place of the old HTML/XHMTL.

<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, “/new-page.asp”
%>

In the above 301 redirect example, you need to change the Location to the URI of your new-page.asp. Include the full URI path unless you are redirecting to a root level page (index.asp, default.asp, etc.). If you are setting up a 301 redirect for a root level page, keep the URI short and without the index.asp file name. For example…

“Location”, “/sub-directory/”

Once you’ve included the above code at the top of your old-page.asp, verify that it is returning the proper server header response using our Check Server Headers tool. You should see a recursive response (2 server responses) returned from the server header that look similar to this…

#1 Server Response: /old-page.asp
HTTP Status Code: HTTP/1.1 301 Moved Permanently
Server: Microsoft-IIS/5.0
Date: Fri, 04 Jun 2004 03:11:15 GMT
Location: /new-page.asp
Connection: Keep-Alive
Content-Length: 0
Content-Type: text/html
Cache-control: private

Redirect Target: /new-page.asp

#2 Server Response: /new-page.asp
HTTP Status Code: HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Fri, 04 Jun 2004 03:11:15 GMT
Connection: Keep-Alive
Content-Length: 14268
Content-Type: text/html
Cache-control: private

The first server response above is telling you that the referenced URI (old-page.asp) has been Moved Permanently. This is evident due to the HTTP Status Code of 301. The Moved Permanently is referred to as a Reason Phrase. The Reason Phrase can be any value although the official term for Status Code 301 is Moved Permanently. Other unofficial 301 Reason Phrases may be; Error or Permanently Moved.

The second server response is telling you that the Redirect Target (Location) is OK. This is how it should be when permanently redirecting an old-page.asp to a new-page.asp. The OK is the official Reason Phrase for Status Code 200.

In reference to spidering entities (crawlers, robots, spiders), the ASP code above and the ASP.NET code below will send a server header response of 301 Moved Permanently and, is instructing the spiders to update their index and replace the old URI (old-page.asp) with the new URI (new-page.asp). This could take several months before results are final.

Related Articles

Random Articles

    1. No Responses to “What Is google Pagerank?”

    2. By eztvhffz on Jan 16, 2009 | Reply

      yTs3N4 xnxznocdwllg, [url=http://xrahzgeqbjxj.com/]xrahzgeqbjxj[/url], [link=http://ufuxritvcdkq.com/]ufuxritvcdkq[/link], http://jgcohiykvodj.com/

    Post a Comment