How to change document root folder to some sub-folder using an .htaccess file

By default the web-contents will be loaded from public_html directory of your domain. If you want to load web contents from any specific sub-folder you can implement this by adding the following lines to the .htaccess file in the public_html folder:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^$ [NC,OR]
RewriteCond %{HTTP_HOST} ^$
RewriteCond %{REQUEST_URI} !folder-name/
RewriteRule (.*) /folder-name/$1 [L]
You need to replace the following 2 parameters in above code:
Write your main domain name instead of parameter.
Write sub-folder name instead of folder-name parameter.

Note: This will work for Apache web server.

Was this answer helpful?

 Print this Article

Also Read

Do you provide remote MySQL in Linux Shared Hosting?

No, due to security reasons, we do not provide remote MySQL in Linux Shared Hosting.

I am having an upload error. What is maximum upload limit in Linux Shared Hosting?

In Linux Shared Hosting, we have restricted the upload size limit to 2 MB but we can raise it to...

What is Parked domain?

Pointing one domain to another domain is called Domain Parking. For e.g. ->...

Do you provide SFTP in Linux shared hosting plans?

No, we do not provide SFTP (Secure FTP over SSH). However, we support, FTPS (FTP over explicit...

How to install MediaWiki in Linux hosting?

For example, you wish to install Media Wiki in "wiki" folder then you should extract the...