If you want to change the document root directory for an addon domain, do not follow the procedures below. Instead, use cPanel to change the addon domain’s document root directory. For more information about how to do this, please see this article.
Method #1: Use symbolic links
You can change the document root directory by moving the contents of the public_html directory to another directory, and then creating a symbolic link that points public_html to the new document root directory. To do this, follow these steps:- Login to your account with SSH
- At the command prompt, type the following command:
- Type the following command, replacing new_document_root with the name of the directory that you want to use as the new document root:
- Use a web browser to test your web site. The browser should display content from the new document root directory.
Restoring the public_html directory
You can restore the original configuration and use the public_html directory as the document root again by reversing the procedure that you followed above. To do this, follow these steps:- Log in to your account using SSH.
- At the command prompt, type the following:
- Type the following command, replacing source_directory with the name of the directory that you want to use as public_html. For example, this directory could be the public_html_backup directory that you created in the previous procedure, the new_document_root directory that you were using for testing, or an entirely different directory:
- Use a web browser to test your web site. The browser should display content from the public_html directory.
Method #2: Use redirection with .htaccess
This method uses redirection rules in an .htaccess file to change the document root directory. With this method, you configure the web server to redirect incoming requests to a subfolder of your choice. To do this, follow these steps:- Log in to cPanel.
- In the FILES section of the cPanel home screen, click File Manager:

- In the left sidebar, click the public_html folder. The folder’s contents appear in the right pane.
- In the list of files, right-click .htaccess, click Edit, and then click Edit again.
If the .htaccess file is not in the list of files, you must create it first. On the top menu bar, click + File . In the New File Name text box, type .htaccess , and then click Create New File .
- Copy and paste the following text into the .htaccess file. Replace example.com with your own domain name, and replace subfolder with the name of the folder that you want to use as the new document root directory. Additionally, if you want to use a different main file for your site instead of index.html, specify the filename you want to use (for example, index.php ):
The subfolder you use must be in the public_html directory.
- Click Save Changes, and then click Close.
- Use a web browser to test your web site. The browser should display content from the new document root directory.
Restoring the public_html directory
You can restore the original configuration and use the public_html directory as the document root again by reversing the procedure that you followed above. To do this, follow these steps:- Log in to cPanel.
- In the FILES section of the cPanel home screen, click File Manager:

- In the left sidebar, click the public_html folder.
- In the file listing, right-click the .htaccess file, and then click Rename.
- In the New file name text box, type an alternate name for the .htaccess file (for example, .htaccess.bak), and then click Rename File.
- Use a web browser to test your web site. The browser should again display content from the public_html directory.