Answer the question
In order to leave comments, you need to log in
Redirect in apache2?
Tell me, there is a
Main site
https://www.site.ru
Accordingly, you need
1 - from www to without www
2 - and from http to https
in htaccess I have
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}/ [R=301,L]
RewriteCond %{HTTPS} =off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^site\.ru
RewriteRule ^(.*)$ https://www.site.ru/$1 [R=permanent,L]
RewriteCond %{HTTP_HOST} ^www.site.ru\.index\.php?module=MainView&page_url=
RewriteRule ^(.*)$ https://www.site.ru/ [R=permanent,L]
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^сайт\.ru$ [NC]
RewriteRule ^(.*)$ https://www.сайт.ru/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Answer the question
In order to leave comments, you need to log in
Where does the 302 redirect come from?
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Or completely remove and configure the redirect only through .htaccess
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question