Push on cpanel the www.domain.com to domain.com

Discussion in 'Site & Server Administration' started by ASTRAPI, Apr 10, 2011.

  1. #1
    Hello

    How can i setup on cpanel when a user is coming to my page using
    www.mydomain.com
    Code (markup):
    to auto forward him to
    mydomain.com ?
    Code (markup):
    I think is better to not use the www

    Thank you
     
    ASTRAPI, Apr 10, 2011 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    add this to your .htaccess

    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
     
    Bohra, Apr 11, 2011 IP
  3. seagate

    seagate Banned

    Messages:
    162
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can use that above or log into your cpanel, go down to Domains and click on Redirect, select the domain. Redirect to: http://name.com then select "Redirect with or without www. "

    This will redirect www.name.com to http://name.com , or http://name.com to http://name.com although there is no difference.

    it makes no differences if its with http:// or not , its both the same
     
    seagate, Apr 11, 2011 IP
  4. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you should use a htaccess redirect but you can use cPanels redirect options or a php header redirect
     
    srisen2, Apr 14, 2011 IP