{"id":2546,"date":"2013-03-28T14:08:02","date_gmt":"2013-03-28T14:08:02","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2013\/03\/28\/changing-the-document-root-with-root-access\/"},"modified":"2025-01-09T15:09:43","modified_gmt":"2025-01-09T20:09:43","slug":"changing-the-document-root-with-root-access","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/","title":{"rendered":"Changing the Document Root for Your Domain"},"content":{"rendered":"<p>InMotion Hosting is able to <strong>change the Document Root location<\/strong> where your <i>Primary Domain<\/i> points to. This allows the file structure to be maintained as the developer has referenced the files in the website&#8217;s code. This article will explain how to get the document root changed for your primary domain.<\/p>\n<div class=\"alert alert-danger\" role=\"alert\"><b>VERY IMPORTANT:<\/b> Changing a primary domain&#8217;s document root is <u>NOT RECOMMENDED<\/u> by InMotion Hosting. cPanel backup and restore packages use the default settings and will <u>NOT<\/u> save your document root changes. For instance, if the cPanel account is moved or restored, the document root change will no longer exist, which may cause your website to behave unexpectedly.<\/div>\n<p><a name=\"shared-doc-root\"><\/a><\/p>\n<h2>Accounts on Shared Servers<\/h2>\n<p>Shared server accounts cannot change their <i>Primary Domain&#8217;s<\/i> document root, because root access is not allowed on Shared servers. Our <a title=\"Click here for how to contact support\" href=\"\/support\/amp\/how-to-get-great-technical-support\/\" target=\"_blank\" rel=\"noopener\">Technical Support<\/a> can change the document root on your Shared server account per your request. You will need to submit this in a <a title=\"Click here to navigate to our guide and learn how to submit a verified ticket request to Technical Support for assistance.\" href=\"\/support\/amp\/submitting-and-checking-on-status-of-tickets\/#submit-ticket\" target=\"_blank\" rel=\"noopener\">verified ticket request<\/a> to Support with the following details included:<\/p>\n<ul>\n<li>Domain to update document root for.<\/li>\n<li>Full path to the directory location you want to change the document root to.<\/li>\n<\/ul>\n<h2>VPS and Dedicated Servers<\/h2>\n<h3>Steps to Change the Document Root (with root access)<\/h3>\n<p>When a VPS or Dedicated server customer needs to make a document root change, they can do so with <a title=\"Click here to navigate to our guide and learn more about root access and how to obtain it.\" href=\"\/support\/server\/ssh\/root-access-faq\/\" target=\"_blank\" rel=\"noopener\">Root Access<\/a>. The steps below will explain how to change the document root of the primary domain, with root access.<\/p>\n<div class=\"alert alert-danger\" role=\"alert\"><b>VERY IMPORTANT:<\/b> InMotion Hosting does not support changes made by customers as the &#8216;root&#8217; user. Any time required by the System Administration team to repair, troubleshoot, or restore services due to changes made (as a result of having root access) may be subject to billing charges. This does not guarantee resolution of technical issues deemed outside the scope of our support.<\/div>\n<ol class=\"article_list\">\n<li>\n<pre class=\"code_block\">ssh root@your-server.com<\/pre>\n<\/li>\n<li>Edit the following file:\n<pre class=\"code_block\">\/var\/cpanel\/userdata\/USER\/DOMAIN<\/pre>\n<div class=\"alert alert-danger\" role=\"alert\"><b>NOTE:<\/b> If you have an SSL certificate installed (for the domain you are modifying the document root directory for), you <u>WILL<\/u> need to edit the following file as well:<\/p>\n<pre class=\"code_block\">\/var\/cpanel\/userdata\/USER\/DOMAIN_SSL<\/pre>\n<\/div>\n<p>Notice the files&#8217; contents are similar to the output below. The areas to edit are indicated by <span style=\"color: #ff0000;\">RED<\/span> text. Note: the &#8220;path:&#8221; line is only present in the non-SSL file. If you have an SSL, both files will need to be edited.<\/p>\n<pre class=\"code_block\"> -    customlog:  -        \nformat: combined        \ntarget: \/usr\/local\/apache\/domlogs\/domain.com  -        \nformat: \"\"%{%s}t %I .\\n%{%s}t %O .\"\"        \ntarget: \/usr\/local\/apache\/domlogs\/domain.com-bytes_log    \n<span style=\"color: #ff0000;\">documentroot: \/home\/USER\/public_html<\/span>    \ngroup: USER    \nhascgi: 1    \nhomedir: \/home\/USER    \nip: 123.45.67.89    \nowner: root    \nphpopenbasedirprotect: 1    \nport: 80    \nscriptalias:  -        \n<span style=\"color: #ff0000;\">path: \/home\/USER\/public_html\/cgi-bin<\/span>        \nurl: \/cgi-bin\/    \nserveradmin: webmaster@domain.com    \nserveralias: www.domain.com    \nservername: domain.com    \nusecanonicalname: 'Off'    \nuser: USER<\/pre>\n<p>Change the following lines in the file:<\/p>\n<pre class=\"code_block\">documentroot: \/home\/USER\/public_html<\/pre>\n<pre class=\"code_block\">path: \/home\/USER\/public_html\/cgi-bin<\/pre>\n<p>The changes will look like the following:<\/p>\n<pre class=\"code_block\">documentroot: \/home\/USER\/public_html\/<span style=\"color: #ff0000;\">new_doc_root_dir<\/span><\/pre>\n<pre class=\"code_block\">path: \/home\/USER\/public_html\/<span style=\"color: #ff0000;\">new_doc_root_dir<\/span>\/cgi-bin<\/pre>\n<\/li>\n<li>When finished editing the document root, run the following scripts while logged in as the root user, to rebuild and restart Apache:\n<pre class=\"code_block\">\/scripts\/rebuildhttpdconf<\/pre>\n<pre class=\"code_block\">systemctl restart httpd<\/pre>\n<p>This ensures that your changes are updated in the Apache configuration and will allow the changes to apply immediately.<\/li>\n<\/ol>\n<div class=\"alert alert-warning\" role=\"alert\">\n<p><b>NOTE:<\/b> When using PHP-FPM as the PHP handler for your server, you will need to restart the PHP-FPM service as well. To restart PHP-FPM services run the following commands:<\/p>\n<pre class=\"code_block\">\/scripts\/restartsrv_cpanel_php_fpm<\/pre>\n<pre class=\"code_block\">\/scripts\/restartsrv_apache_php_fpm<\/pre>\n<\/div>\n<h3>Changing the Document Root (without root access)<\/h3>\n<p>VPS and Dedicated customers that do not have root access cannot change the document root of their main domain. VPS and Dedicated server customers without root access will need to follow the same <a title=\"Click here to scroll up to the instructions for how to request a document root change.\" href=\"\/support\/domain-names\/changing-the-document-root-with-root-access\/#shared-doc-root\" target=\"_blank\" rel=\"noopener\">process as the Shared server customers<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>InMotion Hosting is able to change the Document Root location where your Primary Domain points to. This allows the file structure to be maintained as the developer has referenced the files in the website&#8217;s code. This article will explain how to get the document root changed for your primary domain. VERY IMPORTANT: Changing a primary<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/\"> Read More ><\/a><\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-2546","post","type-post","status-publish","format-standard","hentry","category-domain-names"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Changing the Document Root for Your Domain | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"You can change the document root of your primary domain on vps or dedicated servers if you have root access. this article will explain how.\" \/>\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.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Changing the Document Root for Your Domain | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"You can change the document root of your primary domain on vps or dedicated servers if you have root access. this article will explain how.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2013-03-28T14:08:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-09T20:09:43+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\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.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0ba9f3ef6fadef71df5aa120ff996c41\"},\"headline\":\"Changing the Document Root for Your Domain\",\"datePublished\":\"2013-03-28T14:08:02+00:00\",\"dateModified\":\"2025-01-09T20:09:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/\"},\"wordCount\":512,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Domain Names\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/\",\"name\":\"Changing the Document Root for Your Domain | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2013-03-28T14:08:02+00:00\",\"dateModified\":\"2025-01-09T20:09:43+00:00\",\"description\":\"You can change the document root of your primary domain on vps or dedicated servers if you have root access. this article will explain how.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Changing the Document Root for Your Domain\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0ba9f3ef6fadef71df5aa120ff996c41\",\"name\":\"InMotion Hosting Contributor\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/jamesr\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Changing the Document Root for Your Domain | InMotion Hosting","description":"You can change the document root of your primary domain on vps or dedicated servers if you have root access. this article will explain how.","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.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/","og_locale":"en_US","og_type":"article","og_title":"Changing the Document Root for Your Domain | InMotion Hosting","og_description":"You can change the document root of your primary domain on vps or dedicated servers if you have root access. this article will explain how.","og_url":"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2013-03-28T14:08:02+00:00","article_modified_time":"2025-01-09T20:09:43+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0ba9f3ef6fadef71df5aa120ff996c41"},"headline":"Changing the Document Root for Your Domain","datePublished":"2013-03-28T14:08:02+00:00","dateModified":"2025-01-09T20:09:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/"},"wordCount":512,"commentCount":9,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Domain Names"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/","url":"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/","name":"Changing the Document Root for Your Domain | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2013-03-28T14:08:02+00:00","dateModified":"2025-01-09T20:09:43+00:00","description":"You can change the document root of your primary domain on vps or dedicated servers if you have root access. this article will explain how.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/domain-names\/changing-the-document-root-with-root-access\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"Changing the Document Root for Your Domain"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0ba9f3ef6fadef71df5aa120ff996c41","name":"InMotion Hosting Contributor","url":"https:\/\/www.inmotionhosting.com\/support\/author\/jamesr\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":6,"name":"Domain Names","slug":"domain-names","link":"https:\/\/www.inmotionhosting.com\/support\/domain-names\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=2546"}],"version-history":[{"count":11,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2546\/revisions"}],"predecessor-version":[{"id":128991,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/2546\/revisions\/128991"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=2546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=2546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=2546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}