Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2011
    Posts
    10

    301 Redirect NON WWW to WWW

    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]

  2. #2
    Join Date
    Nov 2010
    Posts
    620
    Quote Originally Posted by p0sixninja View Post
    By default, you see, your site resides on both http://yourdomain.com and http://www.yourdomain.com
    Not really. This may be default for some control panels, but no web server listens to both by default.
    All you need to do is create a .htaccess file
    ...if your web server happens to be Apache and you have mod_rewrite already installed.

  3. #3
    Join Date
    Jul 2011
    Posts
    10
    Nice tip.
    This rule certainly applies to cPanel servers.
    Coz until I did this .htaccess redirect my site was being indexed on both.
    Which made everything a bit messy in terms of SEO.

    This trick has worked for me.
    So if you have cPanel, it's worth a try.

  4. #4
    Join Date
    Apr 2011
    Location
    United Kingdom
    Posts
    38
    Quote Originally Posted by 8088 View Post
    Not really. This may be default for some control panels, but no web server listens to both by default.

    ...if your web server happens to be Apache and you have mod_rewrite already installed.
    That is certainly correct, but for the most of users running something like cPanel or Direct Admin - this would work out of the box.

    Though, obviously, it is only for apache, so forget about it if your host or you are using NGINX or something

    Quote Originally Posted by p0sixninja View Post
    Nice tip.
    This rule certainly applies to cPanel servers.
    Coz until I did this .htaccess redirect my site was being indexed on both.
    Which made everything a bit messy in terms of SEO.

    This trick has worked for me.
    So if you have cPanel, it's worth a try.
    Well, you could have always tried Google Webmater Tools and setting which you wanted to be indexed (with or without www) in google. But, if it's al problem - apache rewrites are a fair SEO get-around for it.

  5. #5
    I use it for all sites. It's true www. is subdomain. Main domain and subdomains rank separately. No good getting linkbacks for main domain and subdomain. It's best to get all linksbacks for one or the other.
    HostXNow - Shared Web Hosting | Semi Dedicated Hosting | Enterprise Reseller Hosting | VPS Hosting

  6. #6
    Join Date
    Jun 2011
    Posts
    36
    Very helpful for new comers indeed, especially the ones that often switch their content.
    << Please see the Rules page for signature limitations. >>

Similar Threads

  1. 301 redirect root to subfolder as well as www to subfolder
    By Jaffery in forum SEO / SEM Discussions
    Replies: 5
    Last Post: 05-08-2012, 07:39 AM
  2. How to 301 Redirect Non-WWW to WWW URLs is all domians in server ???
    By sasky in forum Hosting Security and Technology
    Replies: 5
    Last Post: 07-27-2010, 10:58 AM
  3. 301 Redirects to www.domain w/ ISAPI_Rewrite
    By EVILISCIOUS in forum Programming Discussion
    Replies: 3
    Last Post: 09-21-2006, 10:26 AM
  4. Replies: 13
    Last Post: 08-20-2006, 08:58 AM
  5. Replies: 2
    Last Post: 08-16-2004, 11:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •