---
title: How to Set Document Root outside public_html for Addon Domain OR Sub Domain
description: "By default, cPanel places the document root for addon and subdomains inside the `public_html` directory. However, you can configure the document root to reside outside `public_html` for better organization or security. Here’s how you can do it. **Prerequisites** - Root Access to the server's…"
url: "https://truehost.com/support/knowledge-base/how-to-set-document-root-outside-public_html-for-addon-domain-or-sub-domain/"
updated: "2024-12-02"
category: Cloud servers in Kenya
---

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

By default, cPanel places the document root for addon and subdomains inside the `public_html` directory. However, you can configure the document root to reside outside `public_html` for better organization or security. Here’s how you can do it.

**Prerequisites**

- Root Access to the server's WHM

**Step 1: Log in to WHM either with the root account. Normally you will use one of the URLs below;**

```
http://your_server_ip:2087

https://your_server_hostname:2087
```

![This image has an empty alt attribute; its file name is image-703.png](https://truehost.com/support/wp-content/uploads/2024/11/image-703.png)

- **Navigate to Home /Server Configuration / Tweak Settings**

![](https://truehost.com/support/wp-content/uploads/2024/12/image-50-1024x222.png)

- Use the search box in tweak settings to search for **Restrict document** then find the **Restrict document roots to public_html **option, and set it to **Off**
- Once done, click on Save.

![](https://truehost.com/support/wp-content/uploads/2024/12/image-51-1024x422.png)

This will make it possible for addon and subdomain document root to be created in custom locations, instead of the system forcing them to **public_html**
