Is this possible with Page Rules?

I have 2 sites I am going to sign up with Cloudflare, let’s call them Alpha and Beta.

I want to set up page rules so that any request for the top level of the Alpha site gets redirected to, but any request for a deeper link like 404 just gets served as usual from Alpha. Is this possible in Cloudflare with Page Rules? Also, could this all be made to work whether or not the www is present?

Hi, @ama,

You can try this page rule:

Forwarding Redirect
301 - Permanent Redirect

Please note: no dot before “alpha”, no slash after “com”.

If you have sub-domains other than www, for example,, you should instead create two rules, one for naked domain and another for

Either way, you should create another rule to forward any visit to your plain * domain followed by a query string, such as

This PR would be from:

Again, if you have another sub-domain other than www. you’d need to make two rules.

I hope this works! (It worked on a test website)

Hi floripare,

Thanks for the info. Unfortunately, Cloudflare will not allow me to enter “*” without a trailing slash. When I save the rule, it inserts the trailing slash whether I want it or not. Any thoughts on how to get rid of the trailing slash?


I should also mention that the page rule with the trailing slash does not appear to work. Any requests for just load as before instead of

Also, I tried deleting the rule and re-adding with no luck, and I even deleted the whole domain from Cloudflare and re-added it, and weirdly the page rule came back (with the trailing slash) without me having to add it. Very frustrating.

Forget the trailing slash, I thought it would make a difference, but not in your case. It should work with it.

Both source and target domains must be on Cloudflare. Please see this tutorial on how to properly set the DNS for the target domain, so that Cloudflare can make the Page Rule work:

1 Like

OK, I finally got this working the way I wanted, and for the benefit of anyone else trying to do this, here’s how.

The goal was to have requests for:


get redirected to, but allow requests like:

to load from the server as you would normally expect.

@cbrandt’s suggestion was correct in that I needed to have the domain managed by Cloudflare and have the “orange cloud” turned on (turning it off breaks the redirection). However, I do NOT have the target domain even defined in Cloudflare, never mind orange clouded, and it still works.

I had been reluctant to turn on the orange cloud (CDN) because the site is a SmugMug site, and I had read about how because SmugMug already uses Cloudflare as their CDN, turning on Cloudflare CDN (the orange cloud) for a particular SmugMug site caused no end of problems. Apparently this issue has been fixed.

1 Like

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