301 Redirect - Good SEO technique!

Discussion in 'Search Engine Optimization' started by zrob2012, Mar 4, 2012.

  1. zrob2012

    zrob2012
    uix_expand uix_collapse
    New Member

    Joined:
    Mar 4, 2012
    Messages:
    15
    Likes Received:
    0
    Some of you might wish to discover a really good SEO technique that is so simple to do.
    And yet helps your page rank on search engines such as google.

    By default, you see, your site resides on both http://yourdomain.com and http://www.yourdomain.com

    This means that search engines are going to take twice as long to index you as they are indexing content from both the WWW domain and the NON WWW domain.
    This will affect your page rank and will slow down the length of time it takes for you to get a PR quite considerably.

    Also when people link to your page. Some might link to the NON WWW domain and others to the WWW domain.
    Basically this would cause your page rank to be different for each as some might link more on one than the other.
    In other words you're creating double the work for yourself and the search engine bots.
    The quick way to fix this is to permanently redirect one to the other. See below.

    So, how to fix this? Well, I'm going to show you how you can create a 301 redirect from http://yourdomain.com to http://www.yourdomain.com (NON WWW to WWW).
    You can do this the other way round, and redirect from the WWW to the NON WWW if you wish.

    The technical term for this type of redirect is "Canonical Redirect".

    All you need to do is create a .htaccess file and place it in the PUBLIC_HTML folder (make sure you call it "."htaccess, with the period...think of it as a .htaccess extension.
    Whatever you do, don't upload it as htaccess.txt!). You will also need to make sure that mod_rewrite is enabled on your server (you can ask your hosting provider about this if you're not sure).

    Once you've done that simply add the following code to the .htaccess file.
    This code will tell your site to redirect any visitors who visit your site without inputting the WWW to your WWW domain.
    Anyway, I don't want to confuse you any more. So here's the code...make sure you change yourdomain.com to your domain.

    Code:
    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{http_host} ^yourdomain.com [nc]
    rewriterule ^(.*)$ http://www.yourdomain.com/$1 [r=301,nc]
     

Share This Page