Contact Support : +64 220 256 070

Aimvm
Blog

How to change the default document root folder(/home/account/public_html) to the one you wish?

Posted on: October 28, 2014

This lesson will teach you on how to change the document root folder of your website.

Note: Please note that the new document root location must be within the account itself.

Steps:

1) Login to the server  via SSH.

2) Access the document root location.

3) Create the .htaccess file and add the following codes to it.

The codes to be added:

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]

Remove the domain-name.com with your domain name and ‘folder’ with the name of the sub folder.

4) Access the website.

 

Now you can see that the document root has been changed to the new directory you’ve mentioned in.htaccess file.

 

Search Blog