301 Redirection
Frequently websites are moved, corrected, migrated and redesigned - often the previous structure is changed - but its neccesary as sites evolve. However your in the search engines, people are linked to you and hopefully some people have bookmarked you.
Redirecting the page is a simple task which can be done in several ways - however there is one way that works best for search engines. It is called a permanent redirect. To achieve this you need to put in the header "301" (404 is page not found, 200 is page ok, 302 is page has temporarily moved, check back here again) .
301 redirects in ASP
This is a script developed when one domain was moved a website from one domain to another (to be more precise when we had two copies of a site and wanted to consolidate the traffic for better tracking, promotion and branding)
<%
' 301 redirect if its not UsableHost
if Request.ServerVariables("HTTP_HOST") <> "www.UsableHost.co.uk" then
Response.Status="301 Moved Permanently"
'build the redirect
GotoURL = "http://www.UsableHost.co.uk" &_
Request.ServerVariables("URL")'Add the query string
if Request.ServerVariables("QUERY_STRING") <> "" then
GotoURL = GotoURL & "?" & Request.ServerVariables("QUERY_STRING")
end if'Excecute the redirect
Response.AddHeader "Location", GotoURL
end if
%>
This will go to exactly the same location on UsableHost as it was on the other server, a recent implication of this was to stop a service from scraping our content and resurfacing it with adverts.
It checks if the host (ww.yourdomain.com) is correct, if not it will present a 301. This code can be put into any page, but be aware than it will stop you testing your site locally, so if is best to put into an include that is modified locally.
This means that Google (and your visitors) knows that this page is no longer here, and has gone to the new location - to update links. A 302 means that this page has temporarily moved - i.e. If your site is down or your using a tempory promotion page, you may want to use an error page.
Related Links
- Nelsons blog (a success story)
- The script in action on a clients website- www.DayoAudi.co.uk becomes Sportspn.co.uk (not much to see I am afraid).
- Checking your redirects and hostheaders


