I serve multiple websites for my clients on one server. During development I simply make a subdomain on my own domain. Example client.mydomain.example.
Often my customers already have a domain and email with another provider.
I do not want to host email for my clients.
I have tried three different ways of setting up DNS:
- Make an HTTP redirect from
clientdomain.exampletowww.clientdomain.exampleand then a CNAME record forwww.clientdomain.exmpleto point to temporary subdomain on my serverclient.mydomain.example. - Have an A record from
(*.)clientdomain.tldto my server IP, but leaving MX and such to point to their current email-host. - Set up my own nameservers and use those for my client's domain. Then setup the same way as 2.
As far as I can see there are pros and cons with all three:
- Pros: Convenient. I can change the IP address on my server, move to another serverpark, set up failsafe, load balancing and so on.
Cons: I force my clients to usewww, and if they already have a site onnon-wwwthey might suffer SEO-vise(?). Also the extra CNAME record is bad for page speed. - Pros: No SEO or page-speed issues. Easy setup.
Cons: If I need to change IP, I need to make DNS changes for ALL my client sites. - Pros: No SEO or page-speed issues. If I need to change server, I can do this for all my client sites at once, since DNS settings is conveniently setup on my own name servers.
Cons: I need to run my own name servers. I also have to set up MX records and possibly other DNS records for my customers.
My preferred way right now is 1. since I think the pros outweighs the cons for most of my cases.
Are there any other way to redirect from a domain to a server without specifying the IP-address?
Clarification: Solution 1 works for me, but it is slower because of the two steps before coming to the final A record. Ideally I would want to point both non-www and www to my server domain, but as far as I know, this is not possible with a CNAME record, right?