Redirect lot of subdomains (https://*.mydomain.com BUT www) to https://www.mydomain.com

Hi,
how to redirect all subdomains (https://*.mydomain.com BUT www) to https://www.mydomain.com

I’ve added all the subdomains to the DNS zone as CNAME, but as soon as I create this trafic rule, I got an infinite loop.
I got like 2000 subdomains to redirect.
I need to say somehting like : “redirect all subdomains (https://*.mydomain.com BUT the www one) to https://www.mydomain.com.”
I know how to do it using regex, but the trafic rules don’t seems to handle them

thank you

Can you perhaps add a rule at the top that matches www (which performs some innocent action)?

“Only the highest priority matching page rule takes effect on a request.
Page rules are prioritized in descending order in the Cloudflare dashboard, with the highest priority rule at the top.”

Cloudflare recommends ordering your rules from most specific to least specific."

Source: https://support.cloudflare.com/hc/en-us/articles/218411427

Hi @svanlund

Thanks for your answer.
Do you have an example of innocent action ?

Thanks :slight_smile:

Good question! I was thinking maybe something that doesn’t actually change anything. Like setting “SSL: Strict” if that is already your global setting under SSL/TLS.

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