Prevent double redirects

On my website, I just setup the Cloudflare. But I have some issues, I read some similar treads but probably mine is a bit different and I need some help.
This is what I get in speed tests: Screenshot by Lightshot

In my .htaccess file I have this:
First I want to avoid www from the url:

RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L]

then I want my open a subpage directly when accessing the domain and I make another redirect.
Redirect 301 /index.html

But I noticed that this has bad effect and it slows my website, so I want to avoid this.
If you access on all this urls:

all need to open

Any suggestions what I need to do?


Add a Cloudflare Page Rule:
Match: * and URL Forward (code 301) it to:

The Cloudflare Crypto setting for “Always Use HTTPS” might inject an HTTPS redirect before hitting the Page Rule. If so, turn that feature off and add a second Page Rule:
Match and set it to “Always Use HTTPS”

The first rule will catch any combination of http/https or www/non-www to your root directory and send them to the HTTPS subdirectory. The second rule will catch anybody not using HTTPS and turn it on. The first rule takes priority, so those visitors won’t get the second rule’s HTTPS redirect, as Rule #1 adds HTTPS.

1 Like

Tnx @sdayman I have a progress. I remove all the rules in the .htaccess and add yours.

Now only this is not good … when I want to access the site on this way:
it redirects to
so www is not ommited here.

Any suggestion for this?

Are people actually typing in www and the path? That sounds like an edge case. You would be much better off if you just fixed your site’s directory structure.

You can use .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

Or another page rule that matches* and redirects to$1
Make this Rule #2 and that Always Use HTTPS as Rule 3

Hi @sdayman I just noticed one more thing … If I access some page for ex. Virgo Dates ♍ Zodiac Virgo Eminent Personalities | Culture Astrology it is not changing to https, and if you continue navigate through the website, all pages are without https. Is it possible to fix this?

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