{"id":4609,"date":"2021-02-04T20:54:47","date_gmt":"2021-02-04T20:54:47","guid":{"rendered":"https:\/\/chemicloud.com\/kb\/?post_type=ht_kb&#038;p=4609"},"modified":"2022-04-05T07:32:33","modified_gmt":"2022-04-05T07:32:33","slug":"how-to-change-cpanel-documentroot","status":"publish","type":"ht_kb","link":"https:\/\/chemicloud.com\/kb\/article\/how-to-change-cpanel-documentroot\/","title":{"rendered":"How to Change the cPanel DocumentRoot"},"content":{"rendered":"<p>In this tutorial, you will learn how to change the cPanel documentroot for the main cPanel domain.<\/p>\n    \t\t<div class=\"hts-messages hts-messages--alert   hts-messages--withicon \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tFor this type of change, you will require root access to your server. If you don&#8217;t have root access, you will have to get in touch with your web host and see if they can do the change for you.     \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<h3 id=\"what-is-the-document-root-folder\">What is the Document Root Folder?<\/h3>\n<div class=\"kb-article-container\">\n<p>The document root is the folder where the website files for a domain name are stored. As you can host multiple domain names in cPanel (addon domains and subdomains), you need to have a unique folder for each domain. For the cPanel&#8217;s main domain, the document root is <code>public_html<\/code> and there isn&#8217;t any tool in cPanel that allows you to easily change the document root to something different.<\/p>\n<\/div>\n<h3 id=\"how-to-change-the-cpanel-documentroot\">How to Change the cPanel DocumentRoot<\/h3>\n    \t\t<div class=\"hts-messages hts-messages--danger   hts-messages--withicon \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tIt&#8217;s strongly recommended to make backups of the files below before making any changes. Just in case something may go wrong.     \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<p><strong>Step 1)<\/strong>\u00a0 Use nano or your preferred text editor to edit the files. Once the content of each file will open in the editor, you will have to update the &#8220;documentroot&#8221; value to the new path in the following files:<\/p>\n<pre>\/var\/cpanel\/userdata\/cPanelUsername\/domain.tld\r\n\/var\/cpanel\/userdata\/cPanelUsername\/domain.tld_SSL<\/pre>\n<p><i><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4610 size-large\" src=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/02\/documentroot-783x248.png\" alt=\"cPanel Documentroot\" width=\"643\" height=\"204\" srcset=\"https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/02\/documentroot-783x248.png 783w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/02\/documentroot-300x95.png 300w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/02\/documentroot-768x243.png 768w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/02\/documentroot-50x16.png 50w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/02\/documentroot-60x19.png 60w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/02\/documentroot-100x32.png 100w, https:\/\/chemicloud.com\/kb\/wp-content\/uploads\/2021\/02\/documentroot.png 1278w\" sizes=\"auto, (max-width: 643px) 100vw, 643px\" \/><\/i>In our example, we&#8217;ve modified the <strong>documentroot<\/strong> from \/home\/cPanelUsername\/public_html to \/home\/cPanelUsername\/zen\/public<\/p>\n<p class=\"p1\"><b>Tired of hassling with server management?<span class=\"Apple-converted-space\">\u00a0 <\/span>ChemiCloud is the managed hosting solution designed to save you time and money! <\/b><span class=\"s1\">\ud83e\udd13<\/span><b> Check out our <\/b><span style=\"text-decoration: underline;\"><a href=\"https:\/\/chemicloud.com\/pricing#60b65e4e63b58\" target=\"_blank\" rel=\"noopener\"><span class=\"s2\"><b>web hosting <\/b><\/span><\/a><\/span><b>plans!<\/b><\/p>\n<p><strong>Step 2)<\/strong> The next step is to remove the existing cache files:<\/p>\n<pre class=\"bbCodeBlock-title\">rm \/var\/cpanel\/userdata\/cPanelUsername\/domain.tld.cache \r\nrm \/var\/cpanel\/userdata\/cPanelUsername\/domain.tld_SSL.cache<\/pre>\n<p><strong>Step 3)<\/strong> Rebuild the cache files and the Apache configuration file:<\/p>\n<pre>\/scripts\/updateuserdatacache\r\n\/scripts\/rebuildhttpdconf<code>\r\n<\/code><\/pre>\n<p><strong>Step 4)<\/strong>\u00a0 Restart Apache:<\/p>\n<pre>\/scripts\/restartsrv_httpd<\/pre>\n<p>After following the steps described in this tutorial, the primary domain of your cPanel account will be loading the content from the new documentroot that you&#8217;ve set.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to change the cPanel documentroot for the main cPanel domain. What is the Document Root Folder? The document root is the folder where the website files for a domain name are stored. As you can host multiple domain names in cPanel (addon domains&#8230;<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"ht-kb-category":[34],"ht-kb-tag":[],"class_list":["post-4609","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-troubleshooting"],"_links":{"self":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/4609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/comments?post=4609"}],"version-history":[{"count":3,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/4609\/revisions"}],"predecessor-version":[{"id":7289,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb\/4609\/revisions\/7289"}],"wp:attachment":[{"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/media?parent=4609"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=4609"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/chemicloud.com\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=4609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}