Skip to main content
Help Center
The GoDaddy Community will undergo maintenance starting on Tuesday, August 3rd at 3pm PST / 6pm EST. Learn more
  • GoDaddy Community
  • GoDaddy Website Builders
  • GoDaddy Website Builders

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 
    Go to solution

    Change Primary Domain's Root Folder

    I am trying to find a way to change the primary domain's root folder. Currently, it is set at the root folder "/", but I'd like to use a specific folder; effectively isolating each domain into its own folder.

     

    The Hosting Control Center shows grays out the option to edit the primary domain. Am I stuck with this, or can I get this changed somehow?

    1 ACCEPTED SOLUTION
    ki4jil
    Getting Started

    I edited my .htaccess file in my public_html directory with the following code.

     

    # .htaccess main domain to subdirectory redirect 
    # Do not change this line. 
    RewriteEngine on 
    # Change example.com to be your main domain. 
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$ 
    # Change 'subdirectory' to be the directory you will use for your main domain. 
    RewriteCond %{REQUEST_URI} !^/subdirectory/ 
    # Don't change the following two lines. 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    # Change 'subdirectory' to be the directory you will use for your main domain. 
    RewriteRule ^(.*)$ /subdirectory/$1 
    # Change example.com to be your main domain again. 
    # Change 'subdirectory' to be the directory you will use for your main domain 
    # followed by / then the main file for your site, index.php, index.html, etc. 
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$ 
    RewriteRule ^(/)?$ subdirectory/index.html

     

    I then created a subdirectory for my Primary Domain website and moved all the website files to it except the .htaccess file.  The Primary Domain website should now be redirected to the new subdirectory.  Worked perfect for me.

    View solution in original post

    4 REPLIES 4
    GaryA
    Moderator

    Hi @nerdymunky, thanks for posting.

    There is not a way to change the root folder of the primary domain. As a work around, you can change the primary domain name to be something like "noaccess.yourdomain.com" and then add the primary domain name as a secondary domain. This would allow you to have the files for that site in a folder.
    ^Gary

    Gary - GoDaddy | Community Moderator
    24/7 Support | Check System Status

    Thanks for the reply, though this isn't really doable with running a Wordpress site.

     

    I'll have to be on top of updates and vulnerabilities for my site. I've never seen this sort of persistence for my websites before. If malicious content still gets through, it might be time to find another web host. I'm not really interested in rebuilding all websites every 6 months.

    ki4jil
    Getting Started

    I edited my .htaccess file in my public_html directory with the following code.

     

    # .htaccess main domain to subdirectory redirect 
    # Do not change this line. 
    RewriteEngine on 
    # Change example.com to be your main domain. 
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$ 
    # Change 'subdirectory' to be the directory you will use for your main domain. 
    RewriteCond %{REQUEST_URI} !^/subdirectory/ 
    # Don't change the following two lines. 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    # Change 'subdirectory' to be the directory you will use for your main domain. 
    RewriteRule ^(.*)$ /subdirectory/$1 
    # Change example.com to be your main domain again. 
    # Change 'subdirectory' to be the directory you will use for your main domain 
    # followed by / then the main file for your site, index.php, index.html, etc. 
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$ 
    RewriteRule ^(/)?$ subdirectory/index.html

     

    I then created a subdirectory for my Primary Domain website and moved all the website files to it except the .htaccess file.  The Primary Domain website should now be redirected to the new subdirectory.  Worked perfect for me.

    View solution in original post

    This worked perfectly for me on the first try, thanks for the .htaccess solution