Migrate Wordpress from subdomain to root

Posted May 18, 2017 3.5k views
WordPressDigitalOceanConfiguration ManagementDigitalOcean 1-Click Apps MarketplaceUbuntu 16.04Development


I created a wordpress droplet using DigitalOcean’s One-click apps. I installed the droplet on a staging subdomain (let’s say Now that I’ve completed the site, I’d like to migrate the site from the subdomain to the root domain (i.e. to 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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


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:


You’d change 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.