Have a Question?


How to change my document root folder using an .htaccess file?

You are here:
< All topics
Table of contents

By default your website is loaded from the public_html folder of your account.
The public_html directory is also called web root folder or document root folder.
If you’ve created a test website under a sub-folder and you want it to be displayed when you type your domain name, add the following lines to the .htaccess file in the public_html folder:

 RewriteEngine on
 RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
 RewriteCond %{HTTP_HOST} ^www.domain-name.com$
 RewriteCond %{REQUEST_URI} !folder/
 RewriteRule (.*) /folder/$1 [L]

In the above lines you should replace the following 2 strings:

domain-name.com – Type your own domain name
folder – Type the name of the sub-folder which has the test/development website

Was this article helpful?
0 out Of 5 Stars
5 Értékelés 0%
4 Értékelés 0%
3 Értékelés 0%
2 Értékelés 0%
1 Értékelés 0%
How can we correct this article?
Please submit the reason for your vote so that we can improve the article.