.htaccess перенаправляют www к non-www с SSL/HTTPS

55
задан nyedidikeke 9 April 2019 в 22:32
поделиться

1 ответ

Your condition will never be true, because its like "if (a == a + b)".

I'd try the following:

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

This will capture "google.com" from "www.google.com" into %1, the rest in $1 and after that combining the 2, when HTTP_HOST starts with www (with or without https).

18
ответ дан 26 November 2019 в 17:44
поделиться