How to place document roots for addon/subdomains outside of public_html

  Dedicated Hosting, Shared hosting, WHM

Introduction

In cPanel hosting environments, addon domains and subdomains are usually created inside the public_html directory by default. While this setup works, it can become difficult to manage when hosting multiple websites under a single account.

Placing document roots outside of public_html provides better organization, improved security, and easier maintenance. Each website can have its own isolated directory structure, reducing the risk of accidental file exposure or conflicts between websites.

This guide explains how to create addon domains and subdomains with document roots located outside the public_html directory.

Prerequisites

Before proceeding, ensure the following requirements are met:

  • Access to:
    • cPanel
    • SSH (optional but recommended)
    • WHM/root access (for server-wide configuration if needed)
  • A hosting account with:
    • Addon domain/subdomain creation permissions
    • Proper DNS configuration

IMPLEMENTATION

By default, addon and subdomain document roots are restricted to the publich_hml of the account under which they are created. Please follow the below steps to disable this restriction.

  1. Log in to WHM.

2. Navigate to the following location.
Home>> Server configuration>> Tweak settings

3. Click the “Domains” tab.

4. Change the “Restrict document roots to public_html” setting to “Off.”

5. Click the “Save” button at the bottom of the page.

Conclusion

Placing addon and subdomain document roots outside of public_html is a recommended practice for maintaining a cleaner and more secure hosting environment. It improves website organization, simplifies management, and reduces the risk of conflicts between hosted domains.

By configuring custom document roots either through cPanel or WHM, administrators can create a more scalable and professional hosting structure suitable for managing multiple websites efficiently

LEAVE A COMMENT