How to send a permanent redirect in ASP - ASP Scripts


When you decide to change the URI of a resource in your website it's really important to take care of search engines and users who already bookmarked the resource location.
You should inform them the resource is no longer available at old link but they can get it from a new location.

ASP enables you to send custom HTTP headers including HTTP status codes. One of these is called 301 Moved Permanently and it's used to communicate to a client the resource has moved permanently. The client should be informed as well about the new location and it will happily walk to the new URL without requesting the old one anymore.

You can send an HTTP 301 status code with the following ASP code:

<%

Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.weppos.com/new-page.asp"

%>

The string http://www.weppos.com/newpage.asp must be replaced with your resource new URL.


ASP.weppos.com and ASP.weppos.it are property of Simone Carletti.
Discover my website or visit my Simone Carletti's profile on LinkedIn