How to move WordPress site completely from root domain to subdomain?

I have a WordPress website for blogs, i.e.,

Now I want to migrate the complete blog website to its subdomain, i.e.,

And I am planning to create a new website for

How can I do this? Also, please let me know do I need to install a fresh WordPress for after completing the migration task.

Thanks in advance :)

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.

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.

Hello, @HarshNankani

Once you’ve created the root directory for the sudomain you can move/copy the content of the current site over to the new subdomain (e.g from to

You can copy/move the files over ssh or via sFTP client like FileZilla. It is basically up to you as you might prefer one of the options over the other.

Once the files are moved you also need to make sure that in the database all the references for the old domain - is changed to match the new subdomain -

If you’re already updated the Home and Site URLs from the WordPress admin panel then you can take the next step and update all the references for the old domain - in the database.

**Note:**Please before you proceed take a snapshot of the droplet and also create a backup of the site (both files and database). This will ensure that if something goes wrong you can easily restore your site or droplet if needed

There are few ways to update the references in your database and it’s totally up to you which one you’ll choose. You can either change them manually if they’re not many or use an automation tool like plugin or external app.

One of the external apps that I’ve used and I know for sure that it’s working okay is:

You need to upload the script in your public_html folder and access it your browser, then you’ll need to fill your database details and enter the old name (IP address) and the domain name you want to use. Then you can first use the dry-run option and if there are references that need to be updated you can then run the script and update them.

Also an alternative way is to use a plugin called “Duplicator” it will update all of the paths and references from the dev domain to the main domain. This is why we usually recommend using a plugin called: Duplicator. The plugin will generate a backup for your website’s files and database. Then when you import the files to the new domain, all of the references for the old domain name will be updated properly with the correct ones.

Another option is to use the All-in-One WP Migration plugin. The plugin will do the replacement for you during import. You do not need to use any additional database search and replace

Once this is done you can check the site for any errors as there might be some hardcoded references for the IP address in the files like paths to directories, files and etc.

Additionally if you are going to create a new website for you can simply spin up a new WordPress installation:

Hope this helps! Regards, Alex