{"id":13233,"date":"2024-10-04T19:28:11","date_gmt":"2024-10-04T13:58:11","guid":{"rendered":"https:\/\/www.skynats.com\/?p=13233"},"modified":"2025-10-28T11:47:09","modified_gmt":"2025-10-28T06:17:09","slug":"change-the-cpanel-document-root","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/","title":{"rendered":"How to Change the cPanel Document Root for the main cPanel Domain"},"content":{"rendered":"\n<p>A website document root is the folder in which the files of the websites are stored. When you are hosting multiple subdomains, you will need to add them in different folders for each. Normally the document root is public_html for a cpanel main domain. As cPanel does not provide any tools for changing the document root easily, Changing the document root to a different folder is an essential task for us. Here&#8217;s a step-by-step guide to help you change the document root for a main domain in cPanel.<\/p>\n\n\n\n<p><strong>Prerequisites<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To change the document root of your main cPanel domain, you\u2019ll need root access to the server. This is because the changes require updating the configuration files. If you don\u2019t have root access, contact your web hosting provider for assistance.<\/li>\n<\/ul>\n\n\n\n<p><strong>Important<\/strong>: Always back up your existing configuration before making any changes.<\/p>\n\n\n\n<p>For example, let\u2019s assume we have a <a href=\"https:\/\/cpanel.net\/\">cPanel<\/a> domain example.com, whose document root is currently located in \/home\/example\/public_html<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-1-access-the-server-via-ssh-and-locate-the-current-document-root\"><strong>1. Access the server via SSH and Locate the Current Document Root<\/strong><\/h2>\n\n\n\n<p>The default document root for the main domain is typically in the public_html folder. Before making any changes, confirm where your current website&#8217;s files are stored to avoid the mistake.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-2-create-a-new-directory-optional\"><strong>2. Create a New Directory (Optional)<\/strong><\/h2>\n\n\n\n<p>If you want to change the document root to a new directory, create a new directory inside public_html (or any other desired location). For example, you could create a folder called new_folder in the public_html directory using the mkdir command. Skip this step if the directory already exists.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#mkdir \/home\/example\/public_html\/new_folder<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-normal-font-size\" id=\"h-3-update-the-configuration-files\"><strong>3. Update the Configuration Files<\/strong><\/h3>\n\n\n\n<p>After setting the new document root, modify the location in the \u201cdocumentroot\u201d to the new location for the configuration file, this requires editing the following files<\/p>\n\n\n\n<p>\/var\/cpanel\/userdata\/cPanelUsername\/domain.tld<\/p>\n\n\n\n<p>\/var\/cpanel\/userdata\/cPanelUsername\/domain.tld_SSL<\/p>\n\n\n\n<p>According to our example:<\/p>\n\n\n\n<p>\/var\/cpanel\/userdata\/example\/example.com<\/p>\n\n\n\n<p>\/var\/cpanel\/user data\/example\/example.com_SSL<\/p>\n\n\n\n<h4 class=\"wp-block-heading has-normal-font-size\" id=\"h-4-remove-the-existing-cache-files\"><strong>4. Remove the existing cache files:<\/strong><\/h4>\n\n\n\n<p>Remove the existing cache files of the main domain using the rm command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#rm \/var\/cpanel\/userdata\/example\/example.com.cache \n#rm \/var\/cpanel\/userdata\/example\/example.com_SSLcache <\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading has-normal-font-size\" id=\"h-5-rebuild-the-cache-files-and-the-apache-configuration\"><strong>5. Rebuild the cache files and the Apache configuration<\/strong><\/h5>\n\n\n\n<p>After making the necessary changes, Rebuild the cache files and the Apache configuration to regenerate the cache files and Apache configuration with the changes.<\/p>\n\n\n\n<p>After making the necessary changes, run the following scripts to rebuild the cache files and update the Apache configuration. This ensures that the new document root is applied correctly.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\/scripts\/updateuserdatacache\n#\/scripts\/rebuildhttpdconf<\/code><\/pre>\n\n\n\n<p>Then, Restart the web server (Apache) for the changes to take effect.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\/scripts\/restartsrv_apache<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-conclusion\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>Changing the document root in cPanel is a simple yet powerful way to manage where your website files are stored and served. Whether a new folder is being moved for security reasons or the site\u2019s structure is being reorganized, these steps can be followed to get it done quickly and efficiently<\/p>\n\n\n\n<p>Need help changing the cPanel Document Root for the main cPanel Domain ? Contact us for&nbsp;<a href=\"https:\/\/www.skynats.com\/server-management\/\">server support<\/a>&nbsp;and troubleshooting assistance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A website document root is the folder in which the files of the websites are stored. When you are hosting multiple subdomains, you will need to add them in different folders for each. Normally the document root is public_html for a cpanel main domain. As cPanel does not provide any tools for changing the document [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18,909,910],"class_list":["post-13233","post","type-post","status-publish","format-standard","hentry","category-blog","tag-cpanel","tag-cpanel-document-root","tag-cpanel-domain"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Change cPanel Document Root: Step-by-Step Guide<\/title>\n<meta name=\"description\" content=\"Change the cPanel document root easily with our guide. Enhance your site\u2019s security and performance today\u2014start now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Change the cPanel Document Root for the main cPanel Domain\" \/>\n<meta property=\"og:description\" content=\"Change the cPanel document root easily with our guide. Enhance your site\u2019s security and performance today\u2014start now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/\" \/>\n<meta property=\"og:site_name\" content=\"Server Management Services | Cloud Management | Skynats\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/skynats\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-04T13:58:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-28T06:17:09+00:00\" \/>\n<meta name=\"author\" content=\"Sourav AJ\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@skynatstech\" \/>\n<meta name=\"twitter:site\" content=\"@skynatstech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sourav AJ\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/change-the-cpanel-document-root\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/change-the-cpanel-document-root\\\/\"},\"author\":{\"name\":\"Sourav AJ\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/person\\\/255d12fc66a62db365022ecbb5846276\"},\"headline\":\"How to Change the cPanel Document Root for the main cPanel Domain\",\"datePublished\":\"2024-10-04T13:58:11+00:00\",\"dateModified\":\"2025-10-28T06:17:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/change-the-cpanel-document-root\\\/\"},\"wordCount\":505,\"publisher\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#organization\"},\"keywords\":[\"cpanel\",\"cPanel Document Root\",\"cPanel Domain\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/change-the-cpanel-document-root\\\/\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/change-the-cpanel-document-root\\\/\",\"name\":\"Change cPanel Document Root: Step-by-Step Guide\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#website\"},\"datePublished\":\"2024-10-04T13:58:11+00:00\",\"dateModified\":\"2025-10-28T06:17:09+00:00\",\"description\":\"Change the cPanel document root easily with our guide. Enhance your site\u2019s security and performance today\u2014start now!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/change-the-cpanel-document-root\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.skynats.com\\\/blog\\\/change-the-cpanel-document-root\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/change-the-cpanel-document-root\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Change the cPanel Document Root for the main cPanel Domain\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/\",\"name\":\"Server Management Services | Cloud Management | Skynats\",\"description\":\"Server Management and Cloud Management\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#organization\",\"name\":\"Skynats Technologies\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Sknats-Logo-New-whole.png\",\"contentUrl\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Sknats-Logo-New-whole.png\",\"width\":989,\"height\":367,\"caption\":\"Skynats Technologies\"},\"image\":{\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/skynats\",\"https:\\\/\\\/x.com\\\/skynatstech\",\"https:\\\/\\\/www.instagram.com\\\/skynatstech\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/skynats-technologies\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCvTAjrFJ4_E2MJKwlDHomlg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.skynats.com\\\/blog\\\/#\\\/schema\\\/person\\\/255d12fc66a62db365022ecbb5846276\",\"name\":\"Sourav AJ\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4a121e24658559577bd8d7ee7d696b05d5908df88dd32a6dfac5311f6fe26b86?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4a121e24658559577bd8d7ee7d696b05d5908df88dd32a6dfac5311f6fe26b86?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4a121e24658559577bd8d7ee7d696b05d5908df88dd32a6dfac5311f6fe26b86?s=96&d=mm&r=g\",\"caption\":\"Sourav AJ\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Change cPanel Document Root: Step-by-Step Guide","description":"Change the cPanel document root easily with our guide. Enhance your site\u2019s security and performance today\u2014start now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/","og_locale":"en_US","og_type":"article","og_title":"How to Change the cPanel Document Root for the main cPanel Domain","og_description":"Change the cPanel document root easily with our guide. Enhance your site\u2019s security and performance today\u2014start now!","og_url":"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/","og_site_name":"Server Management Services | Cloud Management | Skynats","article_publisher":"https:\/\/www.facebook.com\/skynats","article_published_time":"2024-10-04T13:58:11+00:00","article_modified_time":"2025-10-28T06:17:09+00:00","author":"Sourav AJ","twitter_card":"summary_large_image","twitter_creator":"@skynatstech","twitter_site":"@skynatstech","twitter_misc":{"Written by":"Sourav AJ","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/#article","isPartOf":{"@id":"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/"},"author":{"name":"Sourav AJ","@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/person\/255d12fc66a62db365022ecbb5846276"},"headline":"How to Change the cPanel Document Root for the main cPanel Domain","datePublished":"2024-10-04T13:58:11+00:00","dateModified":"2025-10-28T06:17:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/"},"wordCount":505,"publisher":{"@id":"https:\/\/www.skynats.com\/blog\/#organization"},"keywords":["cpanel","cPanel Document Root","cPanel Domain"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/","url":"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/","name":"Change cPanel Document Root: Step-by-Step Guide","isPartOf":{"@id":"https:\/\/www.skynats.com\/blog\/#website"},"datePublished":"2024-10-04T13:58:11+00:00","dateModified":"2025-10-28T06:17:09+00:00","description":"Change the cPanel document root easily with our guide. Enhance your site\u2019s security and performance today\u2014start now!","breadcrumb":{"@id":"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.skynats.com\/blog\/change-the-cpanel-document-root\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.skynats.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Change the cPanel Document Root for the main cPanel Domain"}]},{"@type":"WebSite","@id":"https:\/\/www.skynats.com\/blog\/#website","url":"https:\/\/www.skynats.com\/blog\/","name":"Server Management Services | Cloud Management | Skynats","description":"Server Management and Cloud Management","publisher":{"@id":"https:\/\/www.skynats.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.skynats.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.skynats.com\/blog\/#organization","name":"Skynats Technologies","url":"https:\/\/www.skynats.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/08\/Sknats-Logo-New-whole.png","contentUrl":"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2021\/08\/Sknats-Logo-New-whole.png","width":989,"height":367,"caption":"Skynats Technologies"},"image":{"@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/skynats","https:\/\/x.com\/skynatstech","https:\/\/www.instagram.com\/skynatstech\/","https:\/\/www.linkedin.com\/company\/skynats-technologies","https:\/\/www.youtube.com\/channel\/UCvTAjrFJ4_E2MJKwlDHomlg"]},{"@type":"Person","@id":"https:\/\/www.skynats.com\/blog\/#\/schema\/person\/255d12fc66a62db365022ecbb5846276","name":"Sourav AJ","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4a121e24658559577bd8d7ee7d696b05d5908df88dd32a6dfac5311f6fe26b86?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4a121e24658559577bd8d7ee7d696b05d5908df88dd32a6dfac5311f6fe26b86?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4a121e24658559577bd8d7ee7d696b05d5908df88dd32a6dfac5311f6fe26b86?s=96&d=mm&r=g","caption":"Sourav AJ"}}]}},"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/13233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=13233"}],"version-history":[{"count":1,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/13233\/revisions"}],"predecessor-version":[{"id":16407,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/13233\/revisions\/16407"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=13233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=13233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=13233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}