The Noisy Little Monkey Blog

SEO Trade Secrets - 301 Redirects

Posted in SEO by Jon Payne on 31-Jul-2008 18:39:00

301 Redirects are so important when you re-launch, re-design, re-jig or just shake up, your website, that the humble 301 Redirect deserves a more detailed post.

301 Redirects are simple little bits of code that say "Hi, this page has moved - I'll send you to the new one". Now we as humans don't see this, so why are 301 Redirects important?

Well, when you change the content of your site, often all the old pages disappear and result in error pages. These missing pages are known as 404 errors. Gosh! Aren't we having fun with these 3 digit numbers?

Anyway, this is bad news for anyone who has bookmarked the (now missing) pages on your website and slightly inconvenient for them as they'll have to type your URL (your web address) into their browser.

Even worse if the web visitor has arrived on this non-existent page having followed a link from another website which is extolling the virtues of your product and you as a supplier. They ain't buying from you now, you look like some flaky internet con artist.

Possibly even worse than this is when the page is featuring in the natural search engine results of Google or similar, because not only are your prospective customers following this link, finding an error and buying from someone else, but Google itself is repeatedly checking your site and finding 404 errors where it used to find, good, useful information. If you've worked hard on your site it probably has a good Google Page Rank and these missing pages are likely have an adverse effect on the page rank for all the pages within your site.

301 Redirects will stop all this happening!

Use a 301 Redirect to redirect all pages on your old site to your new site permanently. This tells search engines and users that your site has permanently moved. Google recommends that you move and redirect a section or directory first, and then test to make sure that your redirects are working correctly before moving all your content.

It's best not to do a single redirect directing all traffic from your old site to your new homepage. This will avoid 404 errors, but it's not a good user experience. It's more work, but a page-to-page redirect will help preserve your site's ranking in Google while providing a consistent and transparent experience for your users. If there won't be a 1:1 match between pages on your old site and your new site (recommended), try to make sure that every page on your old site is at least redirected to a new page with similar content.

How to do 301 Redirects.

OK, if you're a business owner / web site manager reading this and you've been unnerved by the use of 3 digit error messages, TLAs and page rankery pankery before the lights are off, perhaps you'd be better off sending this email to your web designer and then watching what this man can do with his balls, I assure you, it's very impressive. If however you are up for some hot code action here we go.....

IIS 301 Redirect

1. In internet services manager, right click on the file or folder you wish to redirect
2. Select the radio titled "a redirection to a URL".
3. Enter the redirection page
4. Check "The exact url entered above" and the "A permanent redirection for this resource"
5. Click on 'Apply'

ColdFusion 301 Redirect
<.cfheader statuscode="301" statustext="Moved permanently"> <.cfheader name="Location" value="http://www.new-url.com/new-page.html">

PHP 301 Redirect
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com/new-page.html" );
?>

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

ASP .NET 301 Redirect
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com/new-page.html");
}
</script>

JSP (Java) 301 Redirect
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.new-url.com/new-page.html" );
response.setHeader( "Connection", "close" );
%>

CGI PERL 301 Redirect
$q = new CGI;
print $q->redirect("http://www.new-url.com/new-page.html");

Ruby on Rails 301 Redirect
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.new-url.com/new-page.html"
end

.htaccess 301 Redirect (for HTML 301 Redirects use this too)

1. Either create an .htaccess file, open notepad, name and save the file as .htaccess (there is no extension) or if you already have a .htaccess file on your server, download it to your desktop for editing.

2. Place this code in your .htaccess file:

redirect 301 /old/old.html http://www.new-url.com/new-page.html

3. If the .htaccess file already has lines of code in it, skip a line, then add the above code.

6. Save the .htaccess file and upload to the root folder of your server.

If you are running a Unix server with mod_rewrite enabled you can do some really funky redirects, but I'm not showing you that for nothing. You'll need to buy me sweets.

If you have any questions call Noisy Little Monkey and I'll help you.

Bo!

Tags: SEO

Jon Payne

Jon Payne

Founder and Technical Director of Noisy Little Monkey, Jon blogs about SEO and digital marketing strategy.