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

By default the web-contents of your website will be loaded from public_html directory. If you want to load web contents from sub-folder, you can implement this by adding the following lines to the .htaccess file in the public_html folder. Note that following tutorial is only applicable to Apache web server.

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

Make sure you replace following 2 parameters in above code block.

  1. Replace domain-name.com with your actual main domain name.
  2. Replace folder-name with your sub-folder name.

  • 2 Users Found This Useful

Was this answer helpful?

Related Articles

Do you provide Remote MySQL in Linux Shared Hosting?

No. Due to security reasons, we do not provide remote MySQL in Linux Shared Hosting. If you need...

How many IP addresses do you offer with Shared Hosting Account and a VPS Account?

We do not offer any dedicated IP address with shared hosting plans. If you purchase SSL...

How to add new domain for emails only?

Free Mailbox With Domain Registration You can get one FREE mailbox by registering your domain...

AccuWebHosting Offers PHP 7 Hosting

If you are following recent PHP developments, you must be aware of the latest PHP version (PHP 7)...

What is the URL to access my webmail?

For our Linux users, the webmail URL is https: //www.<yourdomainname.com>:2096. For our...