Cloudflare enforce SSL redirect HTTP to HTTPS

and published
Cloudflare redirect http to https

In this tutorial, we will cover the necessary steps to make Cloudflare enforce SSL on your site by redirecting all non-http traffic to HTTPS using a simple page rule. It does not cover issuing a Cloudflare SSL or installing a FREE Cloudflare SSL CERT it in cPanel, nor does it cover the enabling of SSL in WordPress.

Cloudflare Page Rule 301 Redirect from HTTP to HTTPS

  1. Login to Cloudflare
  2. Select your site using the dropdown menu found in the upper left corner
  3. Click the Page Rules icon at the top of the screen
  4. Click the Create Page Rule button
  5. Enter http://*example.com/* but obviously changing the domain with yours.
  6. Under “Then the settings are:” click + Add a Setting
  7. Click the dropdown list, find and click option “Always Use HTTPS”
  8. Finally click Save and Deploy

Cloudflare Page Rule HTTPS 301 non-www to www

If your site uses www then you might want Cloudflare to handle this aspect for you too, below is a simple page rule that will redirect all non-www traffic to www over HTTPS. This Page Rule assumes that you are using the earlier 301 Redirect from HTTP to HTTPS page rule.

  1. Login to Cloudflare
  2. Select your site using the dropdown menu found in the upper left corner
  3. Click the Page Rules icon at the top of the screen
  4. Click the Create Page Rule button
  5. Enter https://example.com* and obviously changing example domain with your own.
  6. Under “Then the settings are:” click + Add a Setting
  7. Click the dropdown list, find and click option “Forwarding URL”
  8. Change the “Select Status Code” to 301 – Permanent Redirect
  9. Add https://www.example.com/ in the box below, but obviously changing example domain once again with your own domain name
  10. Order, now ensure the order is set to LAST because the rule before is your SSL page rule and will not work correctly if executed first.
  11. Finally click Save and Deploy

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>