Migrate Wordpress from subdomain to root


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!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Accepted 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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.