Cloudflare redirect subdomain to URL

user4725754 picture user4725754 · Oct 23, 2015 · Viewed 15.4k times · Source

I would like to redirect one of my subdomains to an outside URL. Example: my xyz.example.com to outsideurl.net. Is it possible with use of Cloudflare services? I have tried to use Page Rules with help of this tutorial, but it seems this tutorial is for another purposes maybe.

Answer

Kevin Cooper picture Kevin Cooper · Jan 25, 2018

It won't work if you simply create a Page Rule -- you need to add a DNS record as well.

In your case, you can add a CNAME for xyz which directs to @, then set up a Page Rule to forward xyz.example.com to outsideurl.net.

From the FAQ:

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.