WordPress can be moved internally to a different place on the same hosting or server without any downtimes. The technique depends on your reason for moving WordPress to a different directory.
There are two possible situations:
- You want to move WordPress from yourdomain.com to yourdomain.com/something or d1.yourdomain.com to d2.yourdomain.com
- You want to move WordPress from one directory to other without changing your site URL
#1 You want to move WordPress to a new location and address on the same server
Suppose you are running a website on d1.yourdomain.com or yourdomain.com/d1 or yourdomain1.com
AND NOW you want to migrate your website to d2.yourdomain.com or yourdomain.com/d2 or yourdomain2.com
In this case, your website’s URL is changing so you will need to first create a new directory/subdomain or add a new domain via Addon Domains section on cPanel.
Once you do this, a new directory for hosting your old website is created on your server. Next step is to change your website’s address on WordPress admin panel. (This can also be done after the migration process – not recommended)
Updating website’s address from WordPress admin panel:
- Login to your WordPress site
- Navigate to Settings > General panel.
- Now update WordPress address URL and Site address URL to the new address (This can be d2.yourdomain.com or yourdomain.com/d2 or yourdomain2.com)
- Click Save Changes button and close the window
Now all you need to do is transfer the website and the update the new URLs to make internal links, images etc point to your new website URL.
Moving your WordPress files:
- Visit your hosting’s cPanel and open File Manager
- From home directory or (wherever your website’s directory is located) open your website’s directory which you want to move
- From top navigation on cPanel, click Select All and then right-click and select Move option (same can be done from top navigation bar also)
- Now select the location where you want to move your website’s files. For Example: If you are moving yourdomain.com/d1 to yourdomain.com/d2 then the location field should contain /home/yourdomain.com/d2 and vice versa.
Once your website is moved, you will need to update old URLs of your website to point new URL structure to avoid any 404s.
There are various methods to do this, but the easiest one is Velvet Blues Update URLs plugin. Simply login to your newly moved website, install this plugin then visit Tools -> Velvet Blue Update URLs page and type your old website address, your new website address and proceed to replace all old address with new ones.
This will update all old URLs to new ones resulting in zero not found errors on your website.
#2 You want to move WordPress internally without changing the blog address
This means your website is successfully running in one directory but still for some reason you want to change the directory keeping the same website address as before.
There would be a very few reasons when you really want to do this. For example – You have changed the primary domain of your hosting and now you want to move all files from yourdomain.com directory to PUBLIC_HTML directory.
Moving your WordPress files:
- Visit your hosting’s cPanel and open File Manager
- From home directory or (wherever your website’s directory is located) open your website’s directory which you want to move
- From top navigation on cPanel, click Select All and the right click and select Move option (same can be done from top navigation bar also)
- Now select the location where you want to move your website’s files. For Example: If you are moving yourdomain.com to PUBLIC_HTML then the location field should have /home/public_html and vice versa.
If you are moving files away from PUBLIC_HTML then make sure you have already added the domain name using Addon Domains section on cPanel and you are transferring files to that domain’s directory.