The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

302 Redirect of www to non www for the same domain

Discussion in 'General Discussion' started by Vince778, Aug 22, 2011.

  1. Vince778

    Vince778 Member

    Joined:
    Jan 1, 2010
    Messages:
    14
    Likes Received:
    1
    Trophy Points:
    3
    I need to redirect the www version of my domain name to the non www version. cPanel wont allow me to saying that it's points to the same location but I need to do this for the sake of search engines. Normally I'd do this by hand myself but cant now that I'm running cPanel. Any ideas what I should do in this case?

    Say I have a domain name (abc.com) which is set using an A record to an IP address. I have a www CNAMEd to the doamin name. I want all requests for abc.com or www.abc.com to automatically go to abc.com. If they do not then search engines like Google and Yahoo will consider these to be two different domain names and split their ranking evaluation between them.

    I do NOT use the DNS server that comes with cPanel or my system, I set all DNS settings at my domain registrar. This is not a DNS question.

    I want to know how to accomplish this with cPanel plz.

    ty
    Vince
     
  2. alphawolf50

    alphawolf50 Well-Known Member

    Joined:
    Apr 28, 2011
    Messages:
    186
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    .htaccess is your friend. Something like this (not tested). You should also use a 301 redirect (moved permanently) instead of 302 (moved temporarily)

    Code:
    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
    RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
    
     
    #2 alphawolf50, Aug 22, 2011
    Last edited: Aug 22, 2011
Loading...

Share This Page