CPanel Redirection

Discussion in 'Site & Server Administration' started by djrishi, Mar 14, 2009.

  1. #1
    Hi, I am currently using CPanel for my domain hosting.

    I want to do a 301 redirection as follows:

    http://mydomain.com to

    http://www.mydomain.com/


    There are 3 options in cpanel and i am bit confused.

    www redirection:

    Only redirect with www.
    Redirect with or without www.
    Do Not Redirect www.



    Please let me know the option for the above criteria.
     
    djrishi, Mar 14, 2009 IP
  2. hostcoin

    hostcoin Peon

    Messages:
    75
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think you should use " Redirect with or without www. "
    afterall its your choice and requirements ;)
     
    hostcoin, Mar 14, 2009 IP
  3. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #3
    Not sure if it will set 301 redirection but another way is to use .htaccess rule. Just add following two lines in your .htaccess:

    rewritecond %{http_host} ^domain.com [nc]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,nc]

    Kailash
     
    kailash, Mar 15, 2009 IP
  4. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The r=301 makes it a 301 redirection :)
     
    InFloW, Mar 15, 2009 IP