I need to redirect one domain. https://www.mydomain.com to https://mydomain.com.I use this .htaccess and it does not work for me.
I used to have an ssl certificate for https://www.mydomain.com, and it was broken, we registered a new ssl for the hosthttps://mydomain.com
There is only one ssl host in WHM, but cpanel has two hosts, one of which is old www.mydomain.comand mydomain.com(does this affect the redirection?)
.htaccess is below.
RewriteEngine on
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
RewriteRule ^(.*)$ https://mydomain.com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com$ [NC]
RewriteRule ^(.*)$ https://mydomain.com/$1 [R=301,L]
I get a security warning whenever I type https://www.mydomain.com.
What mistake did I make here?
Thanks in advance
source
share