{"id":3377,"date":"2021-07-08T20:08:17","date_gmt":"2021-07-08T14:38:17","guid":{"rendered":"https:\/\/www.24x7serversupport.com\/blog\/?p=3377"},"modified":"2021-07-08T20:08:25","modified_gmt":"2021-07-08T14:38:25","slug":"cpanel-document-root-path-change","status":"publish","type":"post","link":"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/","title":{"rendered":"How to Change Document Root of Primary Domain in WHM\/cPanel"},"content":{"rendered":"\n<p>cPanel\/WHM is a web-based control panel to manage a complete Linux operating system. All the cPanel accounts are created using one primary domain. This article will help you to change the document root for the primary domain of the cPanel user.<\/p>\n\n\n\n<p>You must have root shell access for changing the main\/primary domain document root in cPanel, Use the following steps to change the document root of your primary domain in the cPanel account.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>You must have SSH access to root user to cPanel server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1 \u2013 Update Document Root in cPanel<\/h2>\n\n\n\n<p>Use SSH to get shell access for your server as root account, using your favorite ssh client. I have connected our server using PuTTY. Now edit following file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vim \/var\/cpanel\/userdata\/<strong>USERNAME<\/strong>\/<strong>DOMAINNAME.COM<\/strong>\n<\/pre>\n\n\n\n<p>Change <strong>USERNAME<\/strong> with your cPanel account name.<br>Change <strong>DOMAINNAME.COM<\/strong> with your Primary domain name.<\/p>\n\n\n\n<p>After editing file, search for text documentroot and change path as per your requirements.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">documentroot: \/home\/<strong>USERNAME<\/strong>\/public_html\/<strong>NEW_PATH<\/strong>\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2 \u2013 Changes Document Root for SSL<\/h2>\n\n\n\n<p>If your site is configured to run with ssl, then you also need to edit following file along with the step 1.<\/p>\n\n\n\n<p>Edit file in text editor<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vim \/var\/cpanel\/userdata\/<strong>USERNAME<\/strong>\/<strong>DOMAINNAME.COM_SSL<\/strong>\n<\/pre>\n\n\n\n<p>and apply the same changes as above.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">documentroot: \/home\/<strong>USERNAME<\/strong>\/public_html\/<strong>NEW_PATH<\/strong>\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3 \u2013 Rebuild and Restart Apache<\/h2>\n\n\n\n<p>After making changed, we need to rebuild Apache configuration file and restart Apache server. Use following command to do it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/scripts\/rebuildhttpdconf\nservice httpd restart\n<\/pre>\n\n\n\n<p>Your changes will be permanently updated. Check your site for reflecting changes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>cPanel\/WHM is a web-based control panel to manage a complete Linux operating system. All the cPanel accounts are created using one primary domain. This article will help you to change the document root for the primary domain of the cPanel user. You must have root shell access for changing the main\/primary domain document root in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[38,33],"tags":[],"class_list":["post-3377","post","type-post","status-publish","format-standard","hentry","category-cloudlinux","category-cpanel"],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Change Document Root of Primary Domain in WHM\/cPanel | 24x7serversupport Blog<\/title>\n<meta name=\"description\" content=\"How to Change Document Root of Primary Domain in WHM\/cPanel\" \/>\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.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Change Document Root of Primary Domain in WHM\/cPanel | 24x7serversupport Blog\" \/>\n<meta property=\"og:description\" content=\"How to Change Document Root of Primary Domain in WHM\/cPanel\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/\" \/>\n<meta property=\"og:site_name\" content=\"24x7serversupport Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-08T14:38:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-08T14:38:25+00:00\" \/>\n<meta name=\"author\" content=\"24x7support\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:site\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"24x7support\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/\",\"name\":\"How to Change Document Root of Primary Domain in WHM\/cPanel | 24x7serversupport Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\"},\"datePublished\":\"2021-07-08T14:38:17+00:00\",\"dateModified\":\"2021-07-08T14:38:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\"},\"description\":\"How to Change Document Root of Primary Domain in WHM\/cPanel\",\"breadcrumb\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.24x7serversupport.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Change Document Root of Primary Domain in WHM\/cPanel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/\",\"name\":\"24x7serversupport Blog\",\"description\":\"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\",\"name\":\"24x7support\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Change Document Root of Primary Domain in WHM\/cPanel | 24x7serversupport Blog","description":"How to Change Document Root of Primary Domain in WHM\/cPanel","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.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/","og_locale":"en_US","og_type":"article","og_title":"How to Change Document Root of Primary Domain in WHM\/cPanel | 24x7serversupport Blog","og_description":"How to Change Document Root of Primary Domain in WHM\/cPanel","og_url":"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/","og_site_name":"24x7serversupport Blog","article_published_time":"2021-07-08T14:38:17+00:00","article_modified_time":"2021-07-08T14:38:25+00:00","author":"24x7support","twitter_card":"summary_large_image","twitter_creator":"@24x7serversuppo","twitter_site":"@24x7serversuppo","twitter_misc":{"Written by":"24x7support","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/","url":"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/","name":"How to Change Document Root of Primary Domain in WHM\/cPanel | 24x7serversupport Blog","isPartOf":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#website"},"datePublished":"2021-07-08T14:38:17+00:00","dateModified":"2021-07-08T14:38:25+00:00","author":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401"},"description":"How to Change Document Root of Primary Domain in WHM\/cPanel","breadcrumb":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.24x7serversupport.com\/blog\/cpanel-document-root-path-change\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.24x7serversupport.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Change Document Root of Primary Domain in WHM\/cPanel"}]},{"@type":"WebSite","@id":"https:\/\/www.24x7serversupport.com\/blog\/#website","url":"https:\/\/www.24x7serversupport.com\/blog\/","name":"24x7serversupport Blog","description":"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401","name":"24x7support","url":"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3377","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/comments?post=3377"}],"version-history":[{"count":1,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3377\/revisions"}],"predecessor-version":[{"id":3378,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3377\/revisions\/3378"}],"wp:attachment":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media?parent=3377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/categories?post=3377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/tags?post=3377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}