How to redirect to a new domain on Cloudflare

If you own two domains, and want one to redirect cleanly to the other while using Cloudflare, the configuration is complex.

Say, for example, you want requests to redirect as follows:

First, ensure both domains are listed in your Cloudflare Dashboard under “Websites”. The target domain (e.g. average.name) should already be configured with appropriate DNS for its subdomains.

Next, for clients to attempt to resolve user requests, your alias domain (e.g. avg.name) must have some DNS records. Configure the alias domain with two CNAME records:

Finally, in the “Rules” section of your alias domain, find the “Redirect Rules” section. Create a rule as follows:

Then deploy the new rule.

After a few moments, all requests at your alias domain will redirect as expected.

You can do other transformations in the Target Expression field if you need. You’ll find the reference documentation for the available Fields and Functions on Cloudflare’s site.