Alias domain redirect


#1

I mistakenly created a Cloudflare account for one of my alias domains.

Is it possible to create a Cloudflare account for a domain that points to another Cloudflare domain? If so, how would I handle the redirect?


#2

(replace example.com with the alias domain name)

First, you should create an A record, name pointing to example.com and an IP like 192.0.2.1 with the orange cloud :orange:
Then you should create the record again, but with www instead of example.com (so www will also redirect)

Now, go to page runes and create a page rule like:

Match:

*example.com*

and the only rule being “Forwarding URL” -> 302 status -> to example2.com (the domain you want to forward to)


#3

Thanks. Alias domain is working now.


#4

I am having problem redirecting full URI.

For example, https://nichirenbuddhistchurch.org is configured to 301 redirect to https://sacramentonichirenchurch.org

The page rule has nichirenbuddhistchurch.org/ going to https://sacramentonichirenchurch.org/

This only works for the root domain.

If I use https://nichirenbuddhistchurch.org/contact it does not translate
to https://sacramentonichirenchurch.org/contact/ and instead just sends to the root https://sacramentonichirenchurch.org

Adding * after redirect https://sacramentonichirenchurch.org/* breaks the forwarding.

On my old registrar there was a URL_Redirect setting under host records and this covered all redirect. All traffic sent to https://nichirenbuddhistchurch.org arrived at https://sacramentonichirenchurch.org/, including subdirectories.

Is there something similar available to redirect all traffic from one domain to another?


#5

#6

Here’s my setup:

This doesn’t solve my issue

If I use https://nichirenbuddhistchurch.org/contact it does not translate
to https://sacramentonichirenchurch.org/contact/ and instead just sends to the root https://sacramentonichirenchurch.org