Automatic HTTPS rewrite configuration not working as expected

We have configured our portal where we are using SSL certificate from CloudFlare and using the Page Rules.

We have our htaccess file which performs few rewrites on non-ssl or www urls. Having cloudflare perform https rewrite and using htaccess perform rewrites increases redirect counts, which we want to minimize.

One of the rewrite rules:
RewriteCond %{HTTPS} on [OR]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/terms-of-services$ [OR]
RewriteCond %{REQUEST_URI} ^/terms-of-services/ RewriteRule ^(.*) [L,R=301]

We toggled off “Automatic HTTPS rewrite” and “Always use HTTPS” settings from cloudflare, yet all the urls are redirected to https urls.


If you have end-to-end HTTPS, and HSTS, and all that other good SSL/TLS stuff, then you’ll end up with just one rewrite, max: www. Search engines eventually settle on your canonical URL, so visitors will never get redirects.

For your ToS link, you can do that in a Page Rule here: Match * (maybe a * at the end, if necessary), then Forwarding URL to

Thank for your response, as detailed we have multiple redirects which are handled using htaccess. We don’t want to specify page rules for each combination on cloudflare.

The above is a simple case, but even for that a trailing slash needs to be handled.
Please find the screenshot attached.

So, CloudFlare does the first redirect where it moves all requests to https, after which the htaccess rewrites performs the rules.

Which is why we want the htaccess to handle all the activities, like redirecting non-ssl to ssl urls, but cloudflare configuration is redirecting all urls even after toggling the configuration off.

If you’ve disabled those features, and they’re not in Page Rules, then I’m inclined to think the redirect is coming from your server. Do those initial non-http requests show up in your server log? We can only guess, as we don’t know the actual domain, or IP address to test against the origin. Only Support would be able to track it down.

To contact Cloudflare Customer Support, login & go to and select get more help. If you receive an automatic response that does not help you, please reply and indicate you need more help.

This topic was automatically closed after 30 days. New replies are no longer allowed.