Every subdomain loads its website from a folder in your account called its document root. You might want to change a subdomain's document root to point it at a different copy of your site or tidy up your folders. This guide shows you how to change a subdomain's document root in cPanel.
What is a document root?
The document root is the folder that holds the files a visitor sees. For example, if blog.example.com uses the folder public_html/blog, then index.php in that folder is the page people see at https://blog.example.com.
Your main domain always uses public_html. That can't be changed. Only subdomains can have their document root changed.
How to see a subdomain's current document root
- In cPanel, go to Domains > Domains.
- Find the subdomain in the list. The Document Root column shows the folder it uses. Click the folder link to open it in File Manager.
How to change a subdomain's document root
- If the new folder should already contain the website, upload or copy the files there first, using Files > File Manager. If the folder doesn't exist yet, cPanel will create it.
- In cPanel, go to Domains > Domains.
- Click Manage next to the subdomain.
- Under Update the domain, type the new folder in New Document Root. The path is relative to your home directory and must be inside
public_html, for examplepublic_html/shop. - Click Update.
The change takes effect within a minute or so. Load the subdomain in a private/incognito window to check it.
Things to know before you change it
- Files don't move. Changing the document root only changes which folder the subdomain reads from. The old folder and its files stay where they are. Move or copy them yourself in File Manager if you need to.
- The folder must be inside public_html. Subdomain document roots on Instant Access Internet Services servers must be a folder inside
public_html, such aspublic_html/shop. cPanel will reject a folder anywhere else, including your home directory itself and system folders such asmail,tmporlogs. - WordPress and other apps remember their folder. If a WordPress site on this subdomain is managed in Domains > WordPress Management (WP Toolkit), changing the document root can make WP Toolkit lose track of it. It's safer to leave the document root alone and move content inside WordPress, or ask us before moving it.
- The folder is also reachable from your main domain. Because the folder is inside
public_html, a subdomain usingpublic_html/shopcan also be opened atexample.com/shop. That is normal. If you are using WordPress on your main domain, give the folder a name that doesn't clash with a page or post address.
Common questions
My subdomain shows the same site as my main domain
The subdomain was probably created with Share document root ticked, so it uses public_html. Change its document root to its own folder inside public_html (for example public_html/blog) with the steps above.
After the change, I see "Index of /" or a 403 Forbidden error
The new folder is empty or has no index.html or index.php file. Upload your site files to the new folder.
Can I rename a subdomain instead?
Yes. On the same Manage page, use Rename the domain. This changes the name (for example test.example.com to dev.example.com), not the folder.
Do I need to change DNS after changing the document root?
No. DNS points the subdomain at our server. The document root only controls which folder the server uses.
Related guides
- How to Create a Subdomain in cPanel
- One Website Per Account: What Your Hosting Plan Includes
- How to Use cPanel File Manager to Manage Your Website Files
- How to Create a WordPress Staging Site and Push It Live
Still stuck? Open a support ticket and the Instant Access Internet Services team will help.
