HTTPS redirect and page rules

pagerules

#1

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 http://mydomain.com/* and http://.mydomain.com/ 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.


#2

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

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

#3

That’s slower than having Cloudflare do it.


#4

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


#5

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.

norm


#6

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 example.com has Always Use HTTPS.

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


#7

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


#8

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


#9

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.


#10

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


#11

First Read The Full Article About http to https redirection and work step by step. i am sure your problem soul immedeatly.