I am redirecting 301 in cpanel www to non-www (naked domain) and the code Cpanel redirect generates doesn't do anything when www to non-www is set.
Server Type: (Litespeed Server, domain has "Let's encrypt" certificate.)
- DNS config is (not pointing www to non-www as CNAME)
- both point to same IP
- mydomain.dev - A Record - 127.0.0.1
- www.mydomain.dev - A Record - 127.0.0.1
Non-www to www - works
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain\.dev$
RewriteRule ^(.*)$ "https\:\/\/www\.mydomain\.dev\/$1" [R=301,L]
Www to non-www - doesn't work
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteCond %{HTTP_HOST} ^www\.mydomain\.dev$
RewriteRule ^(.*)$ "https\:\/\/mydomain\.dev\/$1" [R=301,L]
Any ideas?
.dev
TLD? – MrWhite Sep 2 '19 at 14:13