You Can Easily Move Addon Domain Outside Public_html (2021)

Are you using hosting service with cPanel control panel? If yes, then you may already know that the main domain directory in cPanel is public_html. And addon domains are located in a directory inside public_html.

If you have a multi domain hosting server with cPanel as control panel, then this guide will help you to move addon domain outside public_html.

How to move addon domain outside public_html

If your server supports multiple websites hosting, all the domains except the primary must be added as addon domain. While adding them, you might have placed them inside public_html.

Or, it is also possible that, the older server didn’t allow you to place them outside that directory. And, after migrating to new, you realise that the addon domain can be placed outside public _html.

In newer version, cPanel has made it possible to place addon domain outside the public_html. You can easily move all the addon domain outside public_html with zero down-time.

The following is the step by step instructions for moving addon domain outside public_html directory.

1. Login to cPanel control panel

Obviously, you must login to your cPanel account in order to get the job done. To login to your cPanel, you have multiple ways.

  • From Client area of hosting provider
  • From host’s ip address/cpanel
  • From any domain added to that panel/cpanel such as : example.com/cpanel
  • Or any method as instructed by the hosting provider.

2. Go to Domain Section

After logging in to the cPanel, go to Domain section and click on Domain option. From there, you can see all the addon domains added to your server. And with each domain, there will be the Manage button.

You Can Easily Move Addon Domain Outside Public_html (2021)

3. Check Possibility of Modification

Moving addon domain outside public_html is only possible, if the directory can be modified. Therefore, click on the manage button as mentioned above. When you click on this button, any one of the following interface may appear.

  1. The public_html part of domain directory can be modified
  2. The public_html is not editable/ can not be modified.

If the cPanel is updated, an editable version will appear. But, do not change or update it unless making necessary precautions mentioned below. If you update it right now, your website will be down untill you complete all the steps.

Moving addon domain outside public_html in cPanel by editing directory

If unfortunately, the directory can not be modified, the interface will appear like the following. And, you have to leave idea of modifying or moving it.

An older cPanel where moving addon domain outside public_html is not supported.

If you are currently following this instruction, I recommend you to keep this tab open.

4. Backup Website Files

Since your website is important, we cannot take any risks. Therefore, backup the website made with Addon domain.

To backup it, locate the directory where the website files are currently saved. It is easy to locate it, just find the same directory as you see in 3rd step.

Then compress the directory to zip. If it cannot be compressed due to insufficient storage, backup it in chunks.

Compressing Files into Zip

After compression, download it to local storage by right clicking the zip file. Then delete the zip file from there.

If you are using WordPress, you can also backup the website in Google Drive with the help of a plugin.

5. Copy or move the addon domain directory outside public_html

Now, right click and click on copy option to the directory. As soon as you do that, it will show where you want to paste it. This will appear as Home(icon)/public_html. Just remove public_html and click on copy button. Then wait till the files get copied.

Now, your cPanel is ready to serve the files from home/Domain directory as soon as you update the directory for domain that you opened in 3rd step.

If you want to make changes in directory name placed in home, you can do that from rename option at any time. But, you must update it for domain too.

6. Update Document Root Directory for Domain

Till now, your website is being served from public_html/AddonDomain directory. So lets update the domain directory in the tab opened in 3rd step.

Open the manage domain tab, and remove public_html/ from the domain directory as shown in the image below.

Modifying domain directory to place it outside public_html

Make sure, you type the domain directory exactly what you have made outside public_html. This is important, in case you have modified the name in step 5. Otherwise, the same name will work.

7. Check the Website

Now, check the website if it is working properly or not. To check it, clear all the cache, if you are using any CDN. Then refresh the page. If the site is broke, you may have missed something. Therefore, recheck all the steps and reopen the website. It should be working now.

To check if the website is being served from outside, and not from public_html, go to maindomain/addondomain, if it doesn’t redirect to addon domain, your site is currently serving from outside public_html.

8. Delete Old Directory after Moving addon domain outside public_html

After completion of all the steps mentioned above, if everything is working properly, you can delete old directory. This will save your storage. However,it is recommended to keep backup files in local storage for few days, so that you can restore, in case anything goes wrong. For assurance, it won’t get messed up unless it is done incorrectly.

Summary

So, in above guide, you should understand that, you can place addon domain outside public_html. And it is possible only if the domain document root directory can be modified/ updated.

To move addon domain outside public_html, you have to move files in the location or directory you want and update domain document root directory from domain management option.

Leave a Reply