Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- What i'm looking for is the possibility to allow %{HTTP_HOST}%{REQUEST_URI} redirect to https://%{HTTP_HOST}%{REQUEST_URI} all the time.
- And take into account if a Proxy (CloudFlare) is making the request to always use HTTPS. Removing the redirection loop.
- I want to be able to have CF on and off and for both options to work.
- domain -> https://www.domain if from CF then add the proper rule.
- RewriteCond %{HTTP} on
- RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- RewriteCond %{HTTP_HOST} !^www\.
- RewriteRule .* http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- RewriteCond %{HTTP:X-Forwarded-Proto} =http
- RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- RewriteCond %{HTTP_HOST} !^www\.
- RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
- This works to forward everything to WWW but is not taking into account a HTTPS request is available.
- If i enable CF everything is forwarded fine to https://www.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement