mcj
By:
mcj

Migrate Wordpress from subdomain to root

May 18, 2017 381 views
WordPress DigitalOcean Development Configuration Management One-Click Install Apps Ubuntu 16.04

Hello,

I created a wordpress droplet using DigitalOcean's One-click apps. I installed the droplet on a staging subdomain (let's say staging.domain.com). Now that I've completed the site, I'd like to migrate the site from the subdomain to the root domain (i.e. staging.domain.com to domain.com). I'd also like to update all the urls to now use the root domain. I've seen guides to do this using cpanel for other hosting providers but not a cohesive one for DigitalOcean. Has anyone done this and/or can guide me in the right direction?

Thanks ahead of time!

1 Answer
jtittle1 May 18, 2017
Accepted Answer

@mcj

Generally, the only requirement would be that you change the URL's associated with the installation. This could be done from ./wp-admin or by using define() constructs which would be added to the ./wp-config.php file.

For example:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

You'd change example.com to your domain on both.

You may need to modify your Apache VirtualHost as well if it was setup with a sub-domain, though if you've not touched the VirtualHost files, then you should only need to use the above to swap out the URL's.

Before making the change, and so you have something to fall back on, I'd take a snapshot of the Droplet. That way if something goes wrong and you're not able to fix it, you can restore from a snapshot.

Have another answer? Share your knowledge.