When moving an existing WordPress site from one hosting company to another, there are steps you have to consider.
Most migration tools allow you to import a database from the existing install into your new WordPress install on the new server.
The best way is to go with a host like WP Engine, that allows you to set up a staging area, that can be easily ported to the live site.
But let’s say you’re moving an existing website to a host that doesn’t have amenities like staging areas.
You still need to install WordPress on the new server before you import the database from the existing site.
WordPress associates a domain name with each new install. It needs to know what URL to make the main site URL, so it can run the installation.
What if the domain name has to keep pointing at the original site while you set up the new hosting and WordPress installation?
In other words, how do you install WordPress without a domain name?
Installing WordPress When You Can’t Use A Domain Name
You can use the IP address of the new server, with the username of the account for an install URL on most servers. (Check with your hosting to confirm).
You’ll need to define the WP_HOME and WP_SITEURL in the wp-config file found at the root of your new WordPress install.
For an IP of 192.0.2.0 and a username of “username”, these lines would look like this:
These lines would then be added to the wp-config file, right above the line where it says, Stop editing.
What if you need to install WordPress on your hosting as an add-on domain? But the domain name isn’t pointing at the server yet?
In this case, we need to modify our
DEFINE statements a bit. This works for most hosting configurations.
You can find more information about the WP_SITEURL on the WordPress Codex.
After this, you should be able to run the regular installation of WordPress on the new server, and proceed with the migration process.
Once you move the database and files over from the existing server, and you’re ready to point the domain name from the old server to the new server, you can delete these lines. You can also change these defined values to the domain name and new site URL.
Before changing which name servers the domain name points towards, I also recommend using a tool like WP Migrate DB Pro to do a find and replace for instances of the IP domain, and replace them with the permanent domain name. This ensures that links to images and files work once the domain name propagates.
Propagation is the time that it takes for all Internet Service Providers (ISPs) to change the nameservers that the domain name is pointing at. This varies by ISP – they all have different lengths of time that they keep the domain name records fresh.
As always, when migrating your original site, make sure you keep multiple copies of your database backups, in case you need to restore the original site.