HTTP 301 Permanent Redirect Codes
Posted: March 13th, 2008
Every now and again you’ll find yourself in a situation where the naming structure of your pages will change, and even changes in the domain itself. If those changes are occurring to high authority pages, then it’s vital that you properly redirect the old domain/pages such that the new website receives and carries the same authority and PageRank.
For permanent redirection, an HTTP 301 redirect needs to be used. The 301 redirect will properly pass any link juice (authority) as well as instantly redirect user agents to the new website. Visitors, spiders and the like won’t need to click any link or wait for the redirect at all.
The other benefit to a permanent 301 redirect is its ability to keep your site’s search engine rankings. Usually, a 301 redirect will (relatively) instantly have the new domain/website indexed and ranked, while still displaying any old URLs in the main index. These old URLs normally get dropped in under a year, and the time-frame has been getting shorter and shorter.
We have many ways in redirecting user agents to the new URLs, but the best ways to accomplish this are server-side redirects. Here are some codes for the more popular server-side redirects.
301 Redirect via PHP
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.new.com/index.htm");
exit();
301 Redirect via ASP
< %@ Language=VBScript %>
< %
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.new.com/index.asp"
response.end
%>
301 Redirect via .htaccess (mod_rewrite)
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]
The less preferred methods of redirecting user agents are the non-server-side ones. These include JavaScript and meta-refresh. The HTTP header redirect codes above are better since the redirects take place immediately after the headers have loaded. One downside to the JavaScript/META methods is that they cause a visitor’s browser to flicker/refresh as the old webpage loads.
By contrast, redirection via HTTP headers lacks discontinuity, appears seamless and is the way to go.

Nice, simple post. I like how you included .htaccess, ASP and PHP for modifying the headers, usually you only see one of them being shown to you not all.
- Dwayne Charrington.
http://www.dwaynecharrington.com
I’m glad you liked it.
The .htaccess / mod_rewrite seems to be the most used.
the last time I used 301 redirects in my .htaccess file it took more than 6 months for the pagerank(s) to transfer for some reason…
Very timely. I think you just solved the problem I’ve been having with my URL redirect. I purchased a domain name and am using as a redirect to my blogspot site. I recently updated my DNS and lost the ability to use the www in front of my domain name. Thanks!
@Used:
Toolbar Pageranks update whenever Google decides to update them, which usually take a few months to half a year.
@Bobo:
I’m glad I could help.
i have try the permanent redirect,from my main URL to subdomain, but did not update my google PR at all…
so sad for that
How can this be done on blogspot blog cos I just migrate from Blogspot to self-hosted blog?
None of the methods above can be done in blogger/blogspot because they don’t give you any access to server-side services.
Your best bet would be to get a real hosting provider or using a meta-refresh or javascript redirect.