Skip to main content

Document Root: Finding Your Hosting's Root Directory

Where can you find the document root of your web hosting?

In this article, you'll learn what the document root is, where to find your hosting's root directory, and where to upload your website files.


What is the Document Root?

The document root is the root directory of your domain on the web server.

This directory contains the files used by your website, such as HTML files, PHP files, images, and other web content.

When someone visits your domain in a browser, the web server accesses the directory configured as the document root for that domain.

The exact path depends on whether your hosting runs on a Windows web server or a CloudLinux web server.
​

Document Root on Windows Web Servers

On Windows web hosting, the document root is located directly in the main directory of your FTP account.

  • Root directory: /

  • Absolute path: d:\www\<username>

Example:

d:\www\www250

When you connect to your hosting via FTP, you are taken directly to this directory.

You can upload and manage your website files here.
​

Document Root on CloudLinux Web Servers

On CloudLinux web hosting, the document root is located in the /www subdirectory.

  • Root directory: /www

  • Absolute path: /data/www/<username>/www

Example:

/data/www/www250/www

Upload your website files to the /www directory so they can be accessed through your domain.
​

Finding Your Document Root Using PHP

You can also display the absolute path of your document root using a PHP file.

Follow these steps:

  1. Create a new text file.

  2. Insert the following PHP code:

    <?php echo $_SERVER["DOCUMENT_ROOT"]; ?>

  3. Save the file, for example, as root.php.

  4. Upload the file to the desired web directory using FTP.

  5. Open the file through your domain in a browser, for example, https://yourdomain.ch/root.php.

The absolute path of the configured document root will then be displayed.

Important: Delete the file from your hosting after checking the path to prevent the internal server path from remaining publicly accessible.
​

Document Root and Domain Mappings

If you change the directory path of your main domain or configure a domain mapping in the System Configurator, the document root for the affected domain may also change.
​

Example: Subdomain with a Separate Directory

You create the subdomain shop.yourdomain.ch and assign it to the /shop directory.

The subdomain will then load its content from this directory.

Windows Web Hosting

  • Root directory: /shop

  • Absolute path: d:\www\<username>\shop

CloudLinux Web Hosting

  • Root directory: /www/shop

  • Absolute path: /data/www/<username>/www/shop

This allows you to use different root directories for individual domains or subdomains.
​

Further Information

Would you like to link a domain or subdomain to a specific directory?

For more information, see our Help Center article Setting Up Domain Mappings.

Did this answer your question?