Rewrite www to non www under sub vhost

1 post / 0 new
#1 Thu, 10/12/2017 - 04:50
miojamo

Rewrite www to non www under sub vhost

Under main domain I have set redirect which works fine (domain.com):

RewriteEngine On RewriteCond %{HTTP_HOST} ^www.(.)$ [NC] RewriteRule ^/(.)$ https://%1/$1 [R=301,L]

However it does not work for sub servers (sub.domain.com) and I don't know why.

Under Virtualmin config I have also set redirect http to https

Thanks,