

This has to be done from the backend by updating the cPanel user account file at /var/cpanel/userdata/username/domainname. In certain rare scenarios, we have customers who want their document root to be changed to another folder than public_html. By default it is the public_html folder in the user home directory. Updating cPanel filesĬPanel/WHM does not have an option to change the document root of the main domain via any interface. The redirection is set by adding a ‘.htaccess’ in the folder to be redirected and then adding appropriate rewrite URL rules to point to the desired directory. Setting redirects also help to avoid duplication, especially if the same content has to be shown in different sites or subdomains. Setting redirectsĪ commonly used technique for changing cPanel root directory is to set redirects from the public_html to the desired folder which contains the files to be displayed. The folder permissions and ownership and related links in pages have to be properly configured in such scenarios, for the site to work fine after the change. To change cPanel root directory in such cases, we backup the current public_html and then create a symbolic link from the desired directory to public_html. This is usually applicable while testing a new site. For main domain, it is ‘/home/user/public_html’ and for addon domain, it is ‘/home/user/public_html/sub-folder’.īut cPanel offers a feature where website owners can change the default document root for addon domain during creation or after creating it from the cPanel.Ĭhange cPanel root directory of Addon domainĪt times, you may already have another directory which you need to set as your document root. The document root for a domain depends on the type of a domain. They look like independent domains to visitors. Addon domain is a domain that points to a subfolder in the main domain.Īddon domains are configured for customers who prefer to create multiple domains within a single account. Using Addon domainsĬPanel offers a feature for website owners to create ‘Addon domains’ from their control panel. There are 4 ways to change cPanel root directory and the option we choose varies based on the website’s requirement. cPanel – change root directory in these 4 ways These include installing some third party applications which have custom data folders, configuring URL shorteners, testing different sets of applications or configurations for your site. While this is usually fine for most website owners, during certain special scenarios, they may need to change this folder to some other directory.

When you create a domain in your cPanel/WHM server, the document root for that domain would be ‘/home/user/public_html’ directory by default. These files show up when you access the site via browser. cPanel root directory aka Document root – Why do you need to change it?ĭocument root aka cPanel root directory is the default directory in which your website files are stored. In our role as Outsourced Tech Support services for web hosts, account related issues or requests are one common category of tasks that we handle. Many website owners require a lot of customization, features and tweaks to get their desired site. Your website defines the personality of your online business.
