change canonical name in whm/cpanel?

cowboymike

Member
Oct 27, 2012
6
0
1
cPanel Access Level
Website Owner
Hi,
I am new user of whm and cpanel. My account was set up with mydomain.com as the canonical name for the domain. If I want change the canonical name from mydomain.com to www.mydomain.com? can you tell me how I might do that?

I also want to redirect all traffic when users enter http://mydomain.com redirect to http://www.mydomain.com. Would I need to change the cname from mydomain.com to www.mydomain.com?


Happy trails, Mike
 
Last edited:

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello Mike,

Can you please explain what is meant here? Both domain.com and www.domain.com should go to the same location. The domain must be domain.com in order for both to work.

If you need the browser to always show www.domain.com, you'd simply add a redirect into the .htaccess such as the following:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Thanks!