How to do a 301 Redirect
301 permanent Redirect
Redirects are essential for some websites. Without them pages don’t get indexed and that hurts your search engine visibility. The best way to do a redirect is to use a permanent 301 redirect. A permanent 301 redirect sends a status code to the browser alerting that the page has moved and a new page is taking its place-redirecting it permanently.
Here are a few ways you can achieve a 301 redirect:
Redirect from a subdomain to a domain
It is important for SEO that all of your backlinks go to the same URL.
Remember, www.bigoakinc.com, bigoakinc.com, www.bigoakinc.com/index.html and bigoakinc.com/index.html are all different pages to the search engines. We want all the PageRank funneling to one page.
This can be helped with a 301 redirect to send browsers and bots who go to one of your home page variations. Modifying your .htaccess file that sends a 301 redirect status is where to start.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]
If your host doesn’t allow mod_rewrite, you can use this code in an .htaccess file
Redirect 301 http://domain.com/oldpage.html
http://www.domain.com/newpage.html\
Code for various 301 redirects:
PHP Redirect
< ?
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location: http://www.newdomain.com/newdir/newpage.htm’);
exit();
?>
ASP Redirect
<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, “http://www.newsite.com/newdir/newpage.asp”
%>
ASP.NET Redirect

ColdFusion Redirect
< .cfheader statuscode=”301″ statustext=”Moved permanently”>
< .cfheader name=”Location” value=”http://www.new-url.com”>
Please use the information responsibly and be sure this will be a 301 permanent redirect. Moving it again can upset the search engines.



Want to know what Shell is doing?
2 Trackback(s)
Sorry, comments for this entry are closed at this time.