Skip to content

Instantly share code, notes, and snippets.

@inpromotion
Created August 5, 2019 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save inpromotion/454283031f5a9f5b6fb78f54f50ceaa4 to your computer and use it in GitHub Desktop.
Save inpromotion/454283031f5a9f5b6fb78f54f50ceaa4 to your computer and use it in GitHub Desktop.
Редирект с www на без www + редирект на https
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteCond %{HTTP:X-HTTPS} !1 [OR]
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !robots\.txt
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment