Redirect or Forward a CloudFlare Purchased domain to a subdomain

OK, am asking this here before so hopefully I won’t have to bug support :slight_smile:

  1. we are using Cloudflare as the primary DNS for ALL our sites & domains

  2. we are setting up wordpress sites for clients on a subdomains of our domain
    on OUR dedicated server

such as mainsite.com is our main site that uses CloudFlare for dns
and client1.mainsite.com as the clients wordpress site

NOW, some clients want to use a TLD for their business.
AND, we are encouraging clients who wish have that OTHER TLD domain redirect/forward
to their wordpress site ( anotherdomain.com ==> client1.mainsite.com )
that THEY BUY anotherdomain.com FROM CLOUDFLARE
and use CloudFlare for DNS

The Question:
How to set anotherdomain.com - bought from CloudFlare & using CloudFlare for DNS
So traffic to anotherdomain.com (a cloudflare domain)
is sent to client1.mainsite.com or even to client1.mainsite.com/page
??

Keeping in mind, we use CloudFlare as the primary DNS for mainsite.com
and
Wordpress does NOT like it when you change domain names, so you
can’t mask the domain being forwarded - it just takes them to the wordpress root

From that point, the domain name & URL the user sees is the correct one for wordpress
client1.mainsite.com or client1.mainsite.com/page

Using just CNAME records can cause issues with wordpress becuase of domain name issues

If they get their domain from another registrar, they could use forwarding at the registrar,
but I see advantages to having our 300+ clients getting the domains from CloudFlare :slight_smile:

Thanks for any help - and hopefully I didn’t make this too confusing

Sid

Hi @deadparrotsoftware,

A redirect is pretty simple to do on Cloudflare, and your clients should be able to redirect their domain to the subdomain without a problem. They just need a :orange: DNS record for the hostnames they want to redirect and a page rule to perform the redirect. This example shows Redirecting One Domain to Another and is very similar to what you would need to get your clients to do.

If, instead of redirecting, you want to allow them to point their domain to you (this would need server configuration too), you may want to look at https://www.cloudflare.com/ssl-for-saas-providers/.

OK thanks for the help :slight_smile:

To begin, we have all our domains using let’s encrypt for SSL with wildcards
so all the subdomains are covered by one SSL cert

Your SSL for SaaS link didn’t help a whole lot
as what we need is

https://vanitydomain.com ====> https://clientsite.ourmaindomain.com

OR

https://vanitydomain.com ====> https://clientsite.ourmaindomain.com/apage

The other link does show how to do this with page rules, which I expect will work.

Knowing how strapped everyone is these days for money thanks to COVID, I suspect
the vanity domains they register through CloudFlare will be (for now anyway) ‘free’ level
cloudflare accounts, so page rules are very limited. CloudFlare should give those people
registering their domain with CloudFlare an extra page rule :slight_smile:

Again, thanks :slight_smile:

Sid

That’s fine, if you just want the redirect then page rules is the way to go. I just included the SSL for SaaS link as something you may want to consider with your kind of business.

You get 3 page rules on the free plan, which allows for a lot of recorects, since you can use wildcards in the rules to make patterns and increase the matches. i.e. you could create a rule that forwards the path, like one rule for vanitydomain.com ==> clientsite.maindomain.com, vanitydomain.com/page1 ==> clientsite.maindomain.com/page1 etc. all in one.

The Sass / SSL thing might well be useful, but the page did not explain enough, or very well, about what it is, how it is used, etc. :slight_smile:

Sid

Oh, I see. Sorry. They allow your customers to CNAME to your domain, but you control their Cloudflare settings and config. This would be if you want their custom domain to display, rather then just redirecting to your subdomain.

I tuned in a bit late, but have some thoughts:

  1. You’re setting up standalone WordPress sites for your clients, but configured to use a subdomain from your main domain. So far, so good.
  2. But then some of them want to use their own domain. Now it’s going to take a little bit of elbow grease:
  • Now would be a good time to document how to do a Search & Replace in WordPress to set it to their domain, and standardize the process so it will be easy each time a client wants to do this.
  • It shouldn’t be too tough to update that site’s config on your server to use the new domain name. Depending on the server management software you’re using, you can easily tie a second domain to that site. Then remove the old subdomain name.
  • It would be easier if they registered their domain not at Cloudflare if you want to run them under your own Cloudflare account. Then they can point it to your Cloudflare name servers. Or later, their Cloudflare name servers.
  • But it would be better if each client domain had its own Cloudflare account so you can spin it off if necessary. And use Cloudflare’s Multi-User account feature:
    https://support.cloudflare.com/hc/en-us/articles/205065067-Setting-up-Multi-User-accounts-on-Cloudflare

I think that’s all that caught my eye. The separate Cloudflare accounts might be key here, though they need separate email addresses for logins. Start with your own, like [email protected], etc. Multi-user account will let them jump on later if necessary, or you can just change the email address and turn the entire account over to them.

Thanks for the input :slight_smile:

Not really anxious to migrate WordPress to their domains.To begin with, there are 300 of them!
And clients are notoriously bad about changing domains, forgetting to renew etc. etc. The main purpose is to simplify advertising and sending traffic. There are some other reasons as well, like software already in place that would have to be reconfigured to use domains rather than existing subdomains, etc.

Each client TLD domain will have it’s own cloudflare account.
The idea of Multi-User giving some of these guys Admin access to our CloudFlare I am sure would give me nightmares :slight_smile:

As to where they register their domain, that is a good question. We started to use CloudFlare to register domains because we use CloudFlare as the PRIMARY DNS for all our own domains.

Of course, we are putting all of our eggs in one basket there, but hopefully the basket will remain safe and active for many years LOL

Thanks Again :slight_smile:

Sid

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