Wordpress domain mapping with a CNAME record — help!

Soldato
Joined
18 Oct 2002
Posts
14,915
Hi everyone,

This is a bit convoluted so apologies in advance, but any help would be greatly appreciated:

I have a client who manages their own DNS. They have an A Record pointing to a DNS server which they use for a number of services other than hosting websites.

I have built a new Wordpress site which is now ready to go live. Normally I would ask them to update the A record for the root domain so that it points to my hosting. However, this would disrupt their other services and their SSL certificate, so it's not an option.

They currently have two websites which they map using CNAME records:
  • Website 1 is mapped to — www.theirdomain.com — but it's actually hosted at separate.domain1.com
  • Website 2 is mapped to — subdomain.theirdomain.com — but it's actually hosted at separate.domain2.com
  • (The root domain goes to a blank page)

I assume I need to:
  • Purchase a new domain e.g. mydomain.com
  • Set it up as if the new site was running from mydomain.com
  • Ask them to change the CNAME for Website 1 from separate.domain1.com to mydomain.com

However, I'm unsure what I then need to do within Wordpress or .htaccess (or whatever) to ensure that the site behaves as if it was simply www.theirdomain.com
  • Do I need to change the Wordpress Address and/or Site Address?
  • Do I need to configure the .htaccess in some way?
I know it's possible because Website 2 is built with Wordpress, but I've only ever moved sites by updating A record, so this is a new one to me and Google isn't proving very helpful.

Thanks for any advice you can give me.
 
I'm not sure if I understand what you're trying to do, if you have built a new version of website1 and you want it to replace the current one on www.theirdomain.com then you just need to update the A record on separate.domain1.com to point to the hosting of the new site.
 
I'm not sure if I understand what you're trying to do, if you have built a new version of website1 and you want it to replace the current one on www.theirdomain.com then you just need to update the A record on separate.domain1.com to point to the hosting of the new site.
Thanks for the reply.

Unfortunately, it's a bit more complicated than that.

separate.domain1.com is owned by the agency that built the current site. The client has given notice to the agency so come the end of August, separate.domain1.com will cease to exist.

That's why I think I will need to register my own domain to replace separate.domain1.com
 
I see.
Some hosts supply a domain name with the hosting package. My 1and1 account gives me domains like s1293823882424.websitehome.com for each hosting package I set up. You could just set the CNAME to that domain to keep the same setup.

Sounds like the client's DNS manager doesn't know what he's doing though. You dont have an A record pointing to a DNS server - that's the nameserver address. If he's tried changing this before (nameservers) then that would have broken all of his other services on the domain and may be why he thinks changing an A record will break it again. Changing an A record wouldn't have any effect on other services on the domain.
 
I see.
Some hosts supply a domain name with the hosting package. My 1and1 account gives me domains like s1293823882424.websitehome.com for each hosting package I set up. You could just set the CNAME to that domain to keep the same setup.

This might be the solution, my only question is — how is this managed in Wordpress?

If Wordpress is set up to run on s1293823882424.websitehome.com, how does it resolve the correct URLs for www.theirdomain.com?


Sounds like the client's DNS manager doesn't know what he's doing though. You don't have an A record pointing to a DNS server - that's the nameserver address. If he's tried changing this before (nameservers) then that would have broken all of his other services on the domain and may be why he thinks changing an A record will break it again. Changing an A record wouldn't have any effect on other services on the domain.

This is exactly what I was thinking — it seems totally backwards, not least because if you go to the root domain you get a blank page!

I've just been reading up about CNAME flattening, which looks like it might solve the problem but there's no guarantee that their platform supports it.
 
It's best not to hard code the URLs into the config file. Just use the built-in settings for changing the URL and if you have any major problems you can change the settings back directly in the database (assuming you have database access through phpMyAdmin or similar)
 
Yep. This is how I'd do it:
-Change URLs in WordPress settings to www.theirdomain.com (or use a URL updater plugin to do it because sometimes there can be absolute URLs stored in plugin settings, page content, etc and doing a full search and replace on all database tables will sort this)
-Edit your hosts file (assuming your own machine runs windows?) to point www.theirdomain.com to the ip address of the new hosted site.
-Login, test everything works on the new domain.
-Delete entry from hosts file
-Change CNAME entry in DNS
 
Yep. This is how I'd do it:
-Change URLs in WordPress settings to www.theirdomain.com (or use a URL updater plugin to do it because sometimes there can be absolute URLs stored in plugin settings, page content, etc and doing a full search and replace on all database tables will sort this)
-Edit your hosts file (assuming your own machine runs windows?) to point www.theirdomain.com to the ip address of the new hosted site.
-Login, test everything works on the new domain.
-Delete entry from hosts file
-Change CNAME entry in DNS
Ok great, thanks again for your help.

I will give it a go tomorrow — wish me luck!
 
Why don't they point the root @ and www to your hosting and create another A record for the sub domain that points to the other hosting?
What's the gaff with cnames?
 
Back
Top Bottom