Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Redirect from http:// to https:// or https://www having CloudFlare Flexible SSL mode
- a) Basic http:// to https:// redirection, but this block should be used along with CloudFlare Flexible SSL Mode
- RewriteEngine On
- RewriteBase /
- RewriteCond %{HTTPS} !=on
- RewriteCond %{HTTP:X-Forwarded-Proto} !https
- RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
- RewriteCond %{HTTP_HOST} ^www\.example\.com$
- RewriteRule .* https://example.com%{REQUEST_URI} [R=301,L]
- b) The same rule, but redirects to https://www
- RewriteEngine On
- RewriteBase /
- RewriteCond %{HTTPS} !=on
- RewriteCond %{HTTP:X-Forwarded-Proto} !https
- RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
- RewriteCond %{HTTP_HOST} ^www\.example\.com$
- RewriteRule .* https://www.example.com%{REQUEST_URI} [R=301,L]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement