Replacing WP site at example.com with new WP from test.example.com

wordpress

#1

I am about to replace a WP site at a DH-hosted domain with a new WP site (with a fresh database) from a subdomain of the original domain (also currently hosted by DH, of course). In other words, I want to take the new site at test.example.com and put it at example.com, replacing the old WP site at example.com.

Any suggestions for how to do this with the least downtime at example.com?

Example.com and test.example.com are on different SFTP users, and have separate MySQL databases. The old site may have been compromised at some point, so I plan to delete the old SFTP user and database after the replacement is complete.


#2

It’s very quick to change if the SFTP user is the same.

First i would change the user of the new site to the same user as the old site. You will see an option to MOVE the files which is incorrectly worded because it actually copies them.

now wait, until that is completed AND https://www.whatsmydns.net/ shows that the accompanying DNS change for the sub-domain has finished propagating. (likely 4-8 Hours)

When both are operating on the same user…

In WP admin update the URLs for both old and new, reversing them. The save will break both sites. This step MUST be done before the next step.

In your SFTP client:

now one more step, and there is a plugin for it, but WP stores links in it’s database as hard links, so those need to be updated.

If both are on the same USER your downtime is just minutes.


#3

The process is quite easy and it requires switching the DNS entries to transform test.example.com into www.example.com (or example.com, simply). To minimize downtime, please open a support ticket and request to decrease DNS time to propagate. The support team will give you more details.


#4

It’s good to know that support will crank down TTL now. They used to say it wasn’t possible. Of course one must realize that request must be in place in advance, last minute changes don’t help cache time.

A DNS only approach will not complete move a WordPress site.


#5

LakeRat and smaffulli,

Thanks for the advice!

Given that I’ll probably putting finishing touches on test.example.com till the last moment, is there any reason why I wouldn’t want to copy the old, currently public site (no edits going on there) to the test site’s user instead of the other way around? My understanding being that, so long as the files are all there when the DNS change propagates, visitors will get a functioning copy of the old site regardless of which server they’re being pointed to.


#6

So you have two domains: new.example.com and www.example.com. The WWW host is old, bad, vulnerable, etc but still working, has IP address 1.1.1.10. NEW is being worked on, has IP address 1.1.1.20.

When NEW is ready to go live, change the DNS records so that NEW has address to 1.1.1.10 and WWW gets IP 1.1.1.20, changes its name to OLD or whatever you want to call it (and eventually delete it). You can ask Support to lower the TTL so that the new site will be visible more quickly to all your visitors. Until the new DNS information propagates fully, some visitors will see the old site while others will see the new one.

If you don’t mind for some of your customers to see the old site, you can avoid contacting Support :slight_smile:


#7

I’m confused now. Are we talking about adding an unique IP (this domain is on shared hosting) or adding some custom DNS records in the DH panel, or something else entirely?

When I go to Manage Domains in the DH panel and click “DNS” for the parent domain, I see four records with a matching IP (A, ftp, ssh, www) which I assume corresponds to the parent domain, and another four records sharing a different IP which appear to be the same thing for my test site (test, ftp.test, ssh.test, and www.test). Will “adding” custom records which reverse the two IP addresses for these 8 records result in swapping the two IPs?


#8

My bad… I think I made an example that doesn’t apply to you because you’re on shared hosting? I thought you had two separate machines :slight_smile: If your domain is on the same account on shared hosting then you only have one IP. You simply need to edit your current DNS records… Forget what I wrote about the IPs and the records: maybe you already have your NEW and WWW subdomains on the control panel, you just need to switch them around? If so, the changes should be almost immediate.


#9

Also on shared hosting he has no direct control over editing the DNS records.


#10

No, I wouldn’t want to copy the old, currently public site (no edits going on there) to the test site’s user instead of the other way around?


#11

If this question is in regards to my instructions in post 2, those instructions actually exchange old and new sites. While not necessary in many cases, it’s the most convenient method.


#12

Hello,

In my experience, I often create a copy version in a sub folder and I didn’t use sub domain. It is faster and easier if you want to maintenance your website. For example. my website: http://www.globosoftware.net/, I will add to folder http://www.globosoftware.net/dev/