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

www to non www? how?

Discussion in 'Black Hat SEO' started by peter73, Jul 20, 2010.

  1. peter73

    peter73 Regular Member

    Joined:
    Jun 27, 2010
    Messages:
    341
    Likes Received:
    90
    Location:
    X marks the spot----------------------------X
    Hi, I searched all over google but all the tutorials only teach you to redirect from non www to www
    Can someone please help me on what I will put on the .htaccess file?

    I don't want my site to have the www So I've been trying to figure out how to redirect from www to non www

    Thanks for the help
     
  2. meathead1234

    meathead1234 Moderator Staff Member Moderator Premium Member

    Joined:
    Sep 24, 2008
    Messages:
    3,816
    Likes Received:
    13,924
    If you have hosting with cpanel, you can do it in there without the need for htaccess
     
  3. dvdvids

    dvdvids BANNED BANNED

    Joined:
    Apr 5, 2010
    Messages:
    242
    Likes Received:
    188
    Redirect www to non-www:
    <IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{HTTP_HOST} ^http://www.yourdomain.com [NC]RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]</IfModule>
    Redirect non-www to www:
    <IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]</IfModule>
     
    • Thanks Thanks x 1
  4. peter73

    peter73 Regular Member

    Joined:
    Jun 27, 2010
    Messages:
    341
    Likes Received:
    90
    Location:
    X marks the spot----------------------------X
    I already tried that, but there is some error popping up in firefox. Thanks anyway I managed to change now.