Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hhrealestatemedia/7da788c4d51266a9dab43f7bd514c155 to your computer and use it in GitHub Desktop.
Save hhrealestatemedia/7da788c4d51266a9dab43f7bd514c155 to your computer and use it in GitHub Desktop.
Force SSL for WordPress when using Cloudflare, needs the Proto header to prevent the redirect loop. Add this block before the WordPress rules.
#Force to https
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment