Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Redirect from http:// to https:// or https://www having CloudFlare Flexible SSL mode
  2. a) Basic http:// to https:// redirection, but this block should be used along with CloudFlare Flexible SSL Mode
  3.  
  4.  
  5. RewriteEngine On
  6. RewriteBase /
  7.  
  8. RewriteCond %{HTTPS} !=on
  9. RewriteCond %{HTTP:X-Forwarded-Proto} !https
  10. RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
  11. RewriteCond %{HTTP_HOST} ^www\.example\.com$
  12. RewriteRule .* https://example.com%{REQUEST_URI} [R=301,L]
  13.  
  14. b) The same rule, but redirects to https://www
  15.  
  16.  
  17. RewriteEngine On
  18. RewriteBase /
  19.  
  20. RewriteCond %{HTTPS} !=on
  21. RewriteCond %{HTTP:X-Forwarded-Proto} !https
  22. RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
  23. RewriteCond %{HTTP_HOST} ^www\.example\.com$
  24. RewriteRule .* https://www.example.com%{REQUEST_URI} [R=301,L]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement