Answer the question
In order to leave comments, you need to log in
How to redirect from http and www to https without www?
Hello!
Tell me how to make such a redirect for all pages of the site
http:// --> https://
http://www --> https://
https://www --> https://
Answer the question
In order to leave comments, you need to log in
RewriteEngine on
RewriteCond %{HTTPS}_%{HTTP_HOST} ^(?|off_(?:www\.)?(.*)|on_www\.(.*)) [NC]
RewriteRule .* https://%1/$0 [R=301,L]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{SERVER_PORT} !^443
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
everything can be done separately since there is no need to combine fish and meatballs, all search engines understand the sequence of redirects and this does not affect SEO
RewriteEngine On
# Директива включает редиректы.
RewriteBase /
# Без директивы (.*) = /$1 будет /var/wwww/site/web/$1 с директивой = /$1
# Удалить www
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
# Проверяем, содержит ли домен www в начале URL.
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# Перенаправляем удаляем www
# https
RewriteCond %{HTTPS} off
# Проверяем наличие https в URL.
RewriteCond %{REQUEST_URI} !^/bitrix/admin/1c_exchange\.php$ [NC]
# Исключим обмен с 1С, ему требуется только 200
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Перенаправляем протокол на http.
https://site.ru:80
is, then write down the place %{HTTP_HOST
} domain name. RewriteCond %{REQUEST_URI} !^/bitrix/admin/1c_exchange\.php$ [NC]
can be deleted
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question