Is there a way to use “Page Rules” redirect before CF uses “Always Use HTTPS”?
I want to redirect http://example.com to https://www.example.com using just one redirect. When I set “Always Use HTTPS” and “Page Rule”: example.com/* --> https://www.example.com/$1 there are two redirects: first to https://example.com and second https://www.example.com.
- I bet you’re asking because some site tester complained about a landing page redirect. I don’t think it’s worth the effort because site crawlers know the proper URL for your site, and regular users don’t care about the extra redirect.
- If you want to pursue this, then disable “Always Use HTTPS” and do it with two page rules:
i) Match example.com/* and redirect to https://www.example.com/$1
ii) Match http://www.example.com/* and redirect to https://www.example.com/$1
Now you’ll only get one redirect.
Yes, you’re right about 1. Some kind of
As for 2 - I was going to do this similar way, but here two thougts:
a) IMO example.com/* match http://www.example.com/* - I don’t think second rule is necessary.
b) I was wondering, if “Always Use HTTPS” works not only on my domain resources but also for other, externals (like JS, IMGs and so on). If so, this rule won’t be sufficient.
“example.com” will not match subdomains. But it will send http and https without www over to www with https.
Always Use HTTPS doesn’t affect external resources. Automatic HTTPS Rewrites tries to fix internal code that links to http resources.
This topic was automatically closed after 14 days. New replies are no longer allowed.