HostGator – Change Main Domain Root Directory How To

By  |  0 Comments

How can I change my primary domain root folder from /public_html to /public_html/my_new_folder?

Trying to keep your folders organized on a shared host using multiple domains? The website I want to display is in /public_html/my_new_folder but shows the default webpage from the /public_html folder.

HostGator’s tech support said it’s not possible to change the root directory, it’s only applicable for addon domains. Using the .htaccess file and the following code you can change where your root domain points to.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteCond %{REQUEST_URI} !^/my_new_folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_folder/$1
RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteRule ^(/)?$ my_new_folder/index.php [L]
Don’t Use HostGator yet? Check them out, they always have great deals going on for Hosting & Domains.
I couldn’t really find this anywhere else so I thought I should post it for later reference. Hope this helps you out!

James Burr is a seasoned Graphic & Web Designer with a decade of experience. A PR Strategist with a deep understanding of Social & New Media. He is also an avid Gamer who favors FPS Games on PlayStation & PC.

You must be logged in to post a comment Login

Leave a Reply