Cloud Service >> Knowledgebase >> WHM >> How to Set Document Root outside public_html for Addon Domain OR Sub Domain?
submit query

Cut Hosting Costs! Submit Query Today!

How to Set Document Root outside public_html for Addon Domain OR Sub Domain?

To set the document root outside the public_html folder for an addon domain or subdomain, follow these steps based on the control panel you're using:

For cPanel

Log in to your cPanel account.

Navigate to Addon Domains or Subdomains:

For an addon domain: Go to Domains > Addon Domains.

For a subdomain: Go to Domains > Subdomains.

Create a New Domain or Edit the Existing One:

If you're creating a new domain or subdomain, fill out the necessary fields. In the "Document Root" field, you can specify any directory path outside public_html (e.g., /home/username/addon-domain).

If you want to change the document root for an existing domain, find the domain in the list and click Edit to change the document root.

Set the Document Root:

Change the document root to a path outside public_html, such as /home/username/addon-domain.

Save Changes: After editing, save the settings, and the new document root will be applied.

 For Plesk

Log in to your Plesk dashboard.

Navigate to Domains:

Go to Websites & Domains and click on the domain or subdomain you wish to modify.

Change Document Root:

Select the domain or subdomain and click on Hosting Settings.

In the Document Root section, you can specify the path where you want to set the root. You can place it outside the default directory, for example, /var/www/vhosts/domain.com/new-folder.

Apply Changes: Click OK or Apply to save the new document root location.

Directly via FTP or File Manager (Advanced)

If your control panel doesn’t support setting the document root easily:

Access your server via FTP or File Manager.

Move the files:

Move the contents of the addon domain or subdomain to the new location outside public_html.

Edit Apache or Nginx Configuration (if necessary):

Update the virtual host configuration (httpd.conf or .htaccess for Apache, nginx.conf for Nginx) to point to the new document root. This may require root access to the server.

Let me know which method you're using, and I can provide further specific guidance.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!