Redirect multiple subdomain to one subdomain using page rule?

How can i redirect multiple subdomain to one specific subdomain using cloudflare page rule.

Note: redirect without changing the url path (only sub domain change)

For example:


If any of the 3 examples url is type in brower, the should automatically redirect to

How can this be done using cloudflare page rule? Please help

Hi @nicolashellene,

Do you want to do this for all subdomains with a DNS rewcord or just specific ones? If you want this for some specific subdomains, you will have to use separate rules (unless there is a pattern to match them) as Page Rules don’t support Regular Expressions, only basic wildcards.

1 Like

I have 4 subdomain


I want all the 3 first subdomain to redirect to

keeping the path

I’m not sure you can do that without individual rules for each, given that there isn’t really a pattern to match without matching other hostnames as well.

1 Like

Is there any javascript code or cloudflare worker solution about this :thinking:

Yes, there’s a bulk redirect template here:


Please help me how can i use this bulk code, am very new about using cloudflare worker

I surf on YouTube but nothing

Can you provide me a full tutorial please legend :pray::pray::sob::sob:

I assumed since you asked for this that you knew how Workers works.

I can only really refer you to the docs here:

You don’t need to install anything, but can enable Workers on your account, paste and modify the code. You may want to get a developer to help with this if you’re unsure.

1 Like

Ok sir​:+1::star:

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