Disclaimer: This article takes into account that you are already using Cloudflare's nameservers on your domain.
Cloudflare in comparison to other domain registrars makes it a little weird to redirect a subdomain elsewhere.
Instead of using a simple
301 Forward on the DNS section of your Cloudflare dashboard, you have to use Cloudflare's page rules and a
CNAME record (ironically, on the DNS section). Let's start.
Configure Cloudflare's page rules
Login to your dashboard and select the domain you want to configure.
Then, navigate to the page rules tab of your Cloudflare dashboard. This is not under DNS, instead it is under its own section, the "Rules" tab. You can also select it on the right section of "Overview".
Once you're on the page rules tab, go ahead and click on "Create Page Rule" button.
Type the URL (without
https://) that you want to be redirected to another domain. In this case, I want to redirect
status.juanca.org to elsewhere.
If you want a catchall redirection rule, so if the domain matches anything under that route, it will redirect to the new location, use
/* after the domain. The end result would be
Under "then these settings are", select the forwarding URL option with the 301 option if you want a permanent redirect.
Finally, enter the URL that you would like your Cloudflare domain to redirect to within the respective input field. In this case, that would be
After saving, this should be your end result on the "Rules" page.
Apply the rule, and your old domain will now forward to the new one, right? Wrong. There's one more step.
The caveat: a CNAME record
Finally, add a
CNAME record which redirects to
In this case, we'll add a
CNAME record for
@. Don't forget to proxy through Cloudflare! (the orange cloud toggle, "proxy status").
Now everything should be working now!
https://status.juanca.org will redirect to
https://www.juancastatus.org with this config.
From the hidden Cloudflare's FAQ page:
Why isn't a Page Rule working?
The number one reason that a Page Rule isn't working, such as URL forwarding, is that the Page Rule you created is on a record that is not proxied by Cloudflare in your DNS settings.
Example: You have a Page Rule that redirects a subdomain (subdomain.yoursitename.com) back to your root domain (yoursitename.com). If you do not have that record proxied in your DNS settings for the subdomain record (orange cloud), Cloudflare's proxy is not running over the record and a Page Rule will not work because it is going direct to your server.
Also, shout out to Kevin Cooper for his Stack Overflow answer.