Редирект с HTTP на HTTPS в htaccess
Как настроить перенаправление с HTTP на HTTPS в PHP и .htaccess на разных хостингах.
Редирект в PHP
$location = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; exit; }
Timeweb
SetEnvIf X-HTTPS 1 HTTPS RewriteEngine On RewriteBase / RewriteCond %{HTTP:X-HTTPS} !1 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Masterhost
RewriteCond %{HTTP:PORT} !443 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
reg.ru
RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
beget.com
RewriteCond %{HTTP:X-Forwarded-Proto} !=https RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Sprinthost.ru
RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
jino.ru
RewriteCond %{HTTP:X-Forwarded-Protocol} !=https RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]