Moving a WordPress site on a hosting account
Recently, some of our customers have wanted to create a new site with WordPress, keeping their current site live while developing the new one. This article will walk you through the process of replacing the old site with the new WordPress site. This article assumes you have already installed WordPress. You can read how to do that here if not.
Before anything else, you need to log into your shell account. To do this, you'll need a Secure Shell (SSH) client. You can read more about shell access on your hosting account here.
Before anything else, you need to log into your hosting account so that you can move files. To do this, you'll need an FTP client. You can read more about FTP access on your hosting account here.
There are two steps to moving a WordPress site to a different URL. The first is to change the URL of the site in the WordPress options, and then move the WordPress files to that new URL. I'm going to assume that the new WordPress site is at example.com/new and the old site is at example.com.
The first thing you need to do is to navigate to your new WordPress site, and log in as the admin user. In my case, I went to http://example.com/new/wp-login. Once you are logged in, find the settings tab in the sidebar on the left, and select "General". If you can't find the tab, you can navigate to
http://example.com/new/wp-admin/options-general.php instead. Once there, you need to change the values of the WordPress Address and Site Address. In my case, I changed my URL from
http://example.com. Save the changes. You should get a 404 error because the WordPress files don't yet exist at the URL
Once at a shell, your current location will be your home directory. You can use the ls command to get a list of files and directories in your home directory. Use the command cd www to change into the web directory. By running ls again, you'll see a directory that corresponds to the address of your website. Change into the root web directory for your site. For example, if your website was
example.com, then you'd run the command
The first thing we're going to do is move the current site to a new directory called old. You can make the old directory using the command
mkdir old. You can then move all of the files in the current directory to the old directory using the following command
>mv * old/.. You'll see the error message
mv: cannot move `old' to a subdirectory of itself, `old/./old' which is fine.
The last step is to move everything from the new directory (which is now in the old directory) to replace the old site. You would use the command
mv old/new/* . to do this. Once you've done that, the site should be moved. Navigate to the new URL to double check everything works correctly.
Once you are logged in, your location will be your home directory. Navigate to the www directory by double clicking on it. Once there, change into the root web directory for your site by double clicking on it. Once you are there, right click and create a new directory called old. Note that you have to specify the full path. For example:
/home/example/www/example.com/old. Once you have created the directory, use the key combination Ctl + a to select all files in your web root. Click on the old directory while pressing Ctrl to deselect the old directory. Then drag the remaining files into the old directory.
Double click on the old directory and then on the new directory where the WordPress site is. Select all of the files in the WordPress directory and drag them into the root of the website that you'll be able to see in the directory tree in the panel above.
If you have any issues you can email us at email@example.com.