Advertisement
rAthus

.htaccess force HTTPS

Jan 8th, 2019
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. # Force HTTPS
  2. RewriteEngine On
  3. RewriteCond %{SERVER_PORT} ^80$
  4. RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
  5.  
  6. # Force HTTPS without the "Too many redirects" error when behind proxy
  7. RewriteEngine On
  8. RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
  9. RewriteCond %{HTTP:X-Forwarded-Proto} =""
  10. RewriteCond %{HTTPS} !=on
  11. RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement