301 Redirect in ASP

301 Redirect in ASP

Many a times you need to move or rename some of your pages for some reason , if you are utilizing .asp (Windows Active Server Pages) as the underlying technology for your website, then there is a simple 301redirect method that you can utilize for changing URL name.This 301 method allows you to implement a Permanent move/rename of your webpages.

Implementation :

Consider a page named old-page.asp that is to be renamed or to new-page.asp, firstly remove all of the code of that page and place the code given below in that old page.

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


In the above 301 redirect example, you need to change the Location to the URI of your new page. 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”, “http://www.yoursitename.com/sub-directory/”

Once you’ve included the above code at the top of your old-page.asp, you should crosscheck that it is returning the proper server header response using tool to check Server header content.
Doing so, we instruct the spiders to update their index and replace the old URI (old-page.asp) with the new URI (new-page.asp).

After applying 301 redirect you should not be able to browse to the old-page.asp (unless you have auto redirects turned off in your browser).
Always keep you old url (www.yoursitename.old-page.asp ) in place for sometime and include a message which will alert visitors about redirection and of new url and request them to update their bookmark as per new url .


Leave your comment

Pin It on Pinterest

Share This