HTTPS redirect and page rules

I wish to redirect all HTTP to HTTPS except for one directory. Therefore, I can’t use Always use HTTPS on Crypto.

I set up two page rules* and to Always use HTTPS.

Problem is, I cannot use any other page rules since all pages will hit one of the above two page rules and no other page rules will take effect.

If you want to redirect all traffic to https but one directory (e.g.,, you can include these rules in your .htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteCond %{REQUEST_URI} !/xyz
    RewriteRule ^/?(.*)$1 [R,L]

That’s slower than having Cloudflare do it.

Why not set Cloudflare to Always Use HTTP, then create one rule for that directory that has SSL set to Off.

I tried that. It doesn’t work. That’s why I have such a rule turned off. Tell me how to set it up exactly, I’ll do that, and you can see it doesn’t work.


I see…that makes sense. So you have Always Use HTTPS turned off.

Then use the rule I mentioned to force that directory to have SSL set to off.

Then add a rule after that that says has Always Use HTTPS.

Theoretically, the first rule gets matched for no SSL, then skips the rest.

No. I want everything to be HTTPS except one directory. And then, I also want additional page rules to allow more caching.

You’ll need to tie all features for that “special” directory to that one rule. Then take care of everything else in subsequent rules.

No. I don’t have any other special features with that one directory. My problem is with the rest of the site. And, you can’t put multiple features in a page rule that affects SSL.

Never mind. Cloudflare just sent me an e-mail saying this is a problem on their end.

First need to install SSL using FTP or cPanel. Second step involves htaccess redirect to https.
Please read the steps carefully while doing this.