How to move a website to a different directory

Every website is linked to a certain htdocs directory on your account. But sometimes you need to move a website from one htdocs directory to another. This may be necessary if:

  • You are moving to a different domain name (e.g. a free subdomain to a custom domain).
  • You have recreated your domain name and it was assigned to a different directory.

Fortunately, there is no need to rebuild your website from scratch. It’s not difficult to move your website from one directory to another.

How to move a directory

There are two ways to move your website files. You can move the files to the new location, which is the fastest way, or you can copy the files to the new location, which is safer but a lot slower.

Moving an htdocs directory

The fastest, and pretty safe method to transfer your website is by moving the entire htdocs folder. If done correctly, there is no risk of data loss, and it’s nearly instant.

1. Remove the new htdocs directory

Open the file manager for your hosting account, and go to the directory of your NEW domain. Right click the htdocs folder and click Delete.

This will delete the (empty) htdocs folder of the new domain, because we will replace this with the directory that has your website files.

2. Cut the old htdocs folder

Now we go to the location where your old htdocs folder lives. This can be the folder of your previous domain name, or the root folder.

Right click this htdocs folder, and click Cut.

3. Paste the htdocs folder in the new directory

Now go back to the folder where the files should be moved to.

In this folder, click anywhere in the empty space, and choose Paste.

image

That’s it!

Within a second, the htdocs folder will pop up in the new location, with all your website files!

Copying a htdocs directory

If you want to be absolutely sure your files are safe, or you simply want the files to be on both websites, you can also copy the files of your website.

Note beforehand

The first thing to be aware of is that FTP does not support copying files. So the only way to “copy” files is to download them from the old location and upload them to the new one.

Also, please note that the file manager is also just an FTP client. So for the file manager to copy your website, the file manger has to download and re-upload every single file. Also, the file manager is pretty bad at large file transfers.

In other words: you have to use a desktop FTP client, like FileZilla, for this.

Finally, please be aware that copying your website means you will double the disk usage and inode usage. Depending on the size of your website, this may push you over the limit, which will cause the upload to fail.

How to copy a htdocs directory

To copy the files of your website, you can simply download the htdocs directory of the site to your computer first. Then, upload the contents of that htdocs directory to the new directory on your account.

Tips

Set up a redirect on the old domain

If you’re moving from one domain to another, instead of deleting the old domain, you can also setup a redirect to direct traffic from your old domain to your new domain.

To do so:

  1. If you moved the directory from your old domain, create a new directory with the name htdocs in the location where you moved it from.
  2. In the client area, find your account, and go to the Redirects menu.
  3. Create a new redirect for the path /, pointing to your new domain. You’ll want to choose the “301 Permanent” type for this.

Use the Parked/Alias Domains functionality

If you’re moving to a different domain name, and your new domain is a custom domain, you can avoid having to migrate files to begin with.

Instead, when creating your domain, you can set it up as a Parked Domain (control panel) or Alias Domain (client area).

By doing this, you can link your new domain name to the same htdocs directory of your old domain. This with, both your new domain and your old domain will have the same files and show the same website.

You can safely delete the old domain after the new domain has been set up as Parked Domain. But once the old domain is deleted, there is no way to link a different domain to the same directory!

You may need to change additional settings

The steps above describe how to migrate the files of a website. However, this may not be the only thing you need to do.

If you’re migrating to a different domain name, you will likely have to change some settings to update your website URL. How to do this, or whether this is needed at all, depends on your website. For example, for WordPress, you can see this guide: Migrating WordPress – Advanced Administration Handbook | Developer.WordPress.org

In some cases, you will also need to update settings if the directory of your site has changed. However, most websites do not need additional configuration for this.

10 Likes