Landing page redirects (two)


After turning on CF at SiteGround, I am getting two redirects on the website rootname as in “”. This is the part of the .htaccess which appears to be relevant to preventing/minimizing redirects:

# BEGIN HTTPS - added by SiteGround support on 04/17/18
# force https:// (and add www prefix) in a single redirection
# prevent 'chained redirects' reducing 'TTFB' and improving scores
RewriteCond %{HTTPS} !on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_HOST} ^(www\.)?taastrategies\.com
RewriteRule ^(.*)$$1 [R=301,L]
# add www prefix on requests that are sent over HTTPS protocol
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^taastrategies\.com
RewriteRule ^(.*)$$1 [R=301,L]
# set HTTPS env var on forwarded requests (prevent redirection loop)
SetEnvIf X-Forwarded-Proto https HTTPS=on

I opened a ticket with SiteGround regarding landing page redirects for which I am being penalized by PageSpeed:
---------------- ticket to SiteGround support --------------------------------
I have one small problem remaining: user requrests for “” are going through a series of landing page redirects:

All other variations (,, are working without landing page redirects. Can we fix this? Given my rudimentary understanding of RewriteCond syntax, I am not inclined to tackle this without expert assistance.

-------------response from SiteGround support --------------------------------
The thing is that these redirects are added by the CloudFlare itself, i.e. our server forces the connection to www version of the website in order for all of the resources to be served via CloudFlare.
So the only way to fix this, sadly, would be to disable CloudFlare.
------------------- end of response ------------------------------------------------

CF Always Use HTTPS is enabled

So I contacted (free) CF support which pretty much blew off my problem with canned info about 400 and 500 series errors. It appears (from my reading here) that it is not possible to eliminate both redirects without shifting the CF off SiteGround, It does seem to me that it should be possible to eliminate one of the two redirects?

Thank you.


I like how you handle multiple scenarios in .htaccess. You can probably do the same thing with Page Rules, but you should first turn off Cloudflare’s Always Use HTTPS to stop that initial redirect.

Page rules:
#1 Match http://** and forward it to$2
#2 Match* and forward it to$1
#3 Match* and forward it to$1

#3 won’t be necessary if the * in #1 successfully matches the query with/without the leading www. If #1 doesn’t work with the leading *, then remove that first wildcard and change the $2 to a $1.


Thank you. I tested Cloudflare’s Always Use HTTPS. Toggling On/Off appears to have no effect on any of the redirects. Consequently, I have not enabled the Page Rules until I see if the HTTPS toggle is an issue.

My first time doing Page Rules but I think I’ve got it right:

I don’t understand the significance of the $1 and $2.


Right now, your root domain isn’t going through Cloudflare, but the www is. Oddly enough, hitting the root domain using http redirects to www on http. And then the http://www is redirected to https.

The $1 and $2 copy what the corresponding * matches. That way someone hitting a path on HTTP will get redirected to the same path on HTTPS.

closed #5

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