Answer the question
In order to leave comments, you need to log in
How to make a redirect to a single access point from www to without www, taking into account https?
Hello!
RewriteEngine On
RewriteCond %{HTTPS}_%{HTTP_HOST} ^(?|off_(?:www\.)?(.*)|on_www\.(.*)) [NC]
RewriteRule .* https://%1/$0 [R=301,L]
RewriteRule ^(.*)$ /public/$0
Answer the question
In order to leave comments, you need to log in
RewriteCond %{ENV:HTTPS} on
#Если включен https
RewriteRule .* - [E=SSL:s]
#То создаем переменную ssl с текстом s
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
# Проверяем, содержит ли домен www в начале URL.
RewriteRule ^(.*)$ http%{ENV:SSL}://%1/$1 [R=301,L]
# Перенаправляем удаляем www
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question