Change the directory for my default domain

Asked by:
HubFans / n/a Points
2018-01-02 4:34 pm EST
Domain Pointing
My public_html directory has got messy. Most of my domains were installed in subdirectories however was installed directly in the public_html.
I have moved the wordpress install into a public_html/ folder. How do I change the domain setup to look in this directory. I have done this for my sub domains but I cannot work out how to do this on the main domain.



To ask this user for more information, please first login.

To submit an answer, please login.



1,288 Points
2018-01-02 4:47 pm EST
Hello Ian,

Thanks for submitting a question about changing the document root for your domain.

The following .htaccess rule will get you the desired result. Place this code into an .htaccess file for your site:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteCond %{REQUEST_URI} !^/subdirectory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /subdirectory/$1
RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteRule ^(/)?$ subdirectory/index.html [L]

Just make sure to substitute with your primary domain and "subdirectory" with the name of the new subdirectory that contains the new site files.

Christopher M.

To submit a comment on this answer, please first login.

Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!

Help Center Search

Current Customers

Email: Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.