I have a website like subdomain.domain.com with a https certificate. I want redirect everything to my subdomain in https without www. I use the following code in my htaccess file.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
This works for
http://subdomain.domain.com -> https://subdomain.domain.com
http://www.subdomain.domain.com -> https://subdomain.domain.com
https://subdomain.domain.com -> stays as it is (good)
https://www.subdomain.domain.com -> ERR_SSL_PROTOCOLL_ERROR
Any idea what I have to add to redirect like that:
https://www.subdomain.domain.com -> https://subdomain.domain.com