How to Reference the Hostname’s Apex in a Redirect Rule?

Is there a way to reference the hostname’s apex in a redirect rule? For example:

( eq and ne

Is there an operator/variable to do it like this:

( eq $ and ne mail.$)

To answer the question, you compare it to the host field just like in your example, but you need a string.

Should your question be if there was some sort of constant with a variable value, then no. You need to compare against a string value.

I interpret your answer as NO.

The domain of the site that is added to Cloudflare should be the host.http default value that we can reference somehow in the rule.

The benefit of this is seen in the situation when you want to apply the same rule to 100+ sites. Currently, you would need to update the’s value for each site, like:,,

That is correct. I understand what you are trying to achieve, but as mentioned there is no such constant.

If your plan level allows you access to regular expressions, you could probably get the naked domain from the host header and compare that, but that’s only reliable as long as you know on which level the naked domain is. If that is on a level lower than the second, even that would not work.


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