Change container primary domain without removing site files

Normally if you delete the primary domain on a container all your site files will also be deleted. This is because the files are stored on the system in a folder under the primary domain. For example if your domain is your files will be in the folder /home/f323/web/ on the system. But we do have a way to move your files in a few seconds out of the folder so you can change your primary domain.

Go to the terminal

On the container info screen on the left menu you will see a terminal option, you can open this. You now have access to our online terminal for your site, not all commands are available and most are specific. But using this we can use a set of commands on NodeHost to copy your site files as a backup and restore once the domain is changed.

Copy files

In the terminal run nh backup public_html create and the system will only take a second to backup all your files in the /home/f323/web/ folder into /home/f323/public_html_backup. You should always go and check the files are there as you had them via a external FTP program.

Delete the domain and create the new one

Now just delete your domain and create a new one, as a note this will delete all DNS records and Mail accounts also.

Restore files

In the terminal run nh backup public_html restore and the files will be copied back into the current primary domain public_html folder. This may not work if you use the same terminal window as it will still use the OLD domain path, so close the terminal and open it from the sidebar again.


This will NOT remove any files in the new public_html folder but will replace them, so if you did not use index.html before you will need to FTP in or use the panel to delete the default index.html file we create before you will see your old site contents.

Delete backup files

You can run the command nh backup public_html remove to remove the /home/f323/public_html_backup folder and it's files.