Answer the question
In order to leave comments, you need to log in
How to make one redirect to all htaccess rules?
there is a set of rules
# Переадресация с добавлением / в конце
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)(?<!/)$ /$1/ [R=301,L]
# редирект на https://
RewriteCond %{HTTPS} =off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,QSA]
# Переадресация с домена с WWW на домен без WWW
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# редирект на https://
RewriteCond %{HTTPS} =off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [E=RCODE:301,QSA]
# Переадресация с домена с WWW на домен без WWW
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [E=RCODE:301]
# Переадресация с добавлением / в конце
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)(?<!/)$ /$1/ [E=RCODE:301]
RewriteCond %{ENV:RCODE} !^$
RewriteRule (.*) /$1 [R=${ENV:RCODE},L]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question