Redirection via Page Rule not working

There are a number of questions posted on this but I could not find an answer that is satisfactory.

I want to redirect from my domain and sub-domain (www) of my domain to another domain. It must be over https.

I have created the page rule directing from *mydomain.com to the destination URL with a 301-redirect.

I see that in some threads, entering some CNAME records are being suggested. But, it is merely another third-party URL I am redirecting to.

Please help.

Just so I have this correct. You want to redirect all of the requests to your domain and sub domains elsewhere. You need to have the hostnames :orange: for pagerules to apply, and the page rule should match the following

*domain.com/*

Only one page rule will match, so make sure there are no rules above this rule that would match the traffic you want to redirect away.

Yes, all the traffic from my domain and its sub domains to go to another third party URL. Will *domain.com/* direct to that other URL work?
Also, I don’t understand what you meant by the “hostnames”. My domain is connected to Cloudflare. Is that what you are suggesting?

The formatting can get altered, you need (star)example.com/(star)

For the page rule to work, you must have a dns entry (ie. hostname) for every name you expect to be redirected (example.com, www.example.com or something.example.com). This includes dns records for the root or naked domain (example.com, entered as @ in dns records).

Also, each hostname or dns record must be :orange: for the page rules to apply.

1 Like

Please pardon my ignorance in this regard.
So, when you are talking about DNS records, which one are you talking about? A or CNAME? And what will be value in that case? the third party URL?

Okay, just for people who will be reading this thread in future. The solution is:
Along with the 301-redirect in the Page Rules, add two DNS entries:
A entry (name: your domain, value: IPv4 address of the domain of the destination URL)
CNAME entry (name: www, value: your domain)
And as Michael said, each hostname or dns record must be :orange: for the page rules to apply.

The A (or AAAA) does not need to be “real”. You just need a record so that Cloudflares DNS respond with one of their IP addresses. Nothing will ever hit the origin IP, so what the result is is almost irrelevant.

Probably best to not use a CNAME as you could end up in an orange on orange issue, and your setup stops working as expected.

I use a AAAA record pointing to 2001:db8:: for this type of record, where all traffic will hit a page rule.

That’s very helpful, Michael.:slightly_smiling_face:

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