Skip to content

Instantly share code, notes, and snippets.

@muks999
Forked from artikus11/.htaccess
Created October 9, 2018 12:52
Show Gist options
  • Save muks999/dc6647e7cfbff08c54e5aed561d75ec3 to your computer and use it in GitHub Desktop.
Save muks999/dc6647e7cfbff08c54e5aed561d75ec3 to your computer and use it in GitHub Desktop.
Редирект с http На https
#Вариант 1
RewriteCond %{HTTP:X-HTTPS} !1
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
#Вариант 2
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#Вариант 3
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) http://%{HTTP_HOST}:443/$1 [L,R]
#Now, rewrite to HTTPS:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment