1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

htacess and non www to www

Discussion in 'Black Hat SEO' started by greggggg, Jun 22, 2011.

  1. greggggg

    greggggg Regular Member

    Joined:
    Apr 24, 2011
    Messages:
    383
    Likes Received:
    21
    Can someone tell me how to redirect or use the htaccess ot make my www and non www the same. Right now my non www is ranking instead of my www site. i normally wouldn't care, but I have only about 10 high quality links built to the non www while I have about 120 other links at the www site. Whats the best way to combine them for max link juice.
     
  2. bzy39

    bzy39 Regular Member

    Joined:
    Jan 15, 2009
    Messages:
    434
    Likes Received:
    239
    get it via google
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
     
  3. drogon

    drogon Elite Member Premium Member

    Joined:
    May 28, 2010
    Messages:
    2,108
    Likes Received:
    1,004
    You need to check how your site is setup first.

    If Wordpress then Login to your Admin area dashboard, click on 'Settings' and under 'General Settings', change the Site address (URL) to include the 'WWW'. You will also need to update your sitemap to reflect the changes and new location.

    If your site is already setup correctly then your Host provider (if a decent) should have a redirect option in the control panel.
     
    • Thanks Thanks x 1
  4. Biggles

    Biggles Registered Member

    Joined:
    Jun 19, 2011
    Messages:
    61
    Likes Received:
    25
    No, don't do it through the host. What GoDaddy does for example is add a host record so that both the www and non-www versions work, but this is two separate URLs and can be seen as content duplication.

    A 301 redirect using a .htaccess file will mean that anybody who goes to the non-www version gets redirected to the www version. This will give a cannonical URL and get rid of the content duplication issue.

    It's also useful if you have multiple domains pointing to the same content.

    I'd post my .htaccess file, but I can't get it through the filters.