Parking a domain

I have a bunch of domains that have always been parked on top of a primary domain through WHM/cPanel.

For example, let’s say that I have foo.com and bar.com, and park bar.com on top of foo.com. Then if someone goes to bar.com/lorem/ipsum, the address bar doesn’t change but they see the page from foo.com/lorem/ipsum.

Is there a way to do the same thing in Cloudflare?

The closest I’ve found is to changed the MX Record for the “parked” domain to the main domain, then 301 redirect using Rules > Redirect Rules:

All Incoming Requests
[Static] [https://www.maindomain.com] [301]

This doesn’t keep the parked domain in the address bar, though, of course. Which is OK in some situations, it’s just not the same as parking.

Is there an easier / faster / better way?

It works the same at Cloudflare as anywhere. If your origin server is set up to answer to bar.com, you point that to the server’s IP address in your DNS config.

I was hoping there might be a magic trick that didn’t use the server :slight_smile:

My domains were all at Namecheap and they have a “BasicDNS” option where you can redirect a domain before it ever gets to the server, I was hoping that CF might have something similar.

The way that doesn’t involve the server is the redirect you described. That can be done entirely within Cloudflare by creating a dummy AAAA record for bar.com pointing to 100:: (including the colons) and adding a redirect rule for it.

If you want the content from foo.com to show up while the browser is showing bar.com then the server needs to be configured to answer to bar.com, otherwise it can’t know what content to return. That would be what Namecheap is doing.

1 Like

This might be a stupid question, but… proxied?

And do I need a second AAAA for WWW?

Yes, and yes. Proxied because that’s necessary for any Cloudflare features to be applied. Another record for www if you want that name to work, too.

Basically you need to create some kind of DNS entry that sends the browser to Cloudflare. The dummy entry accomplishes that without pointing to any actual server. www is a different name, so you need another entry for that name to work.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.