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

Fix :: Joomla Error : Joomla php index page was rendering as text

Problem Statement Joomla website stopped working Error Message Joomla php index page was...

What is the URL to access my web based control panel?

For Linux users, the cPanel URL is www.<yourdomainname.com>:2083.For Windows users, the...

Do you have any limits for setting up Cron jobs or schedule tasks?

Windows Shared Hosting Plans:We do not offer cron jobs in Windows shared hosting plans. Linux...

How to generate a website Installer Backup from Softaculous?

You can generate a backup of the scripts which are installed using Softaculous. If you have...

What is the Max_execution_time allowed for Linux shared server?

Default Max_execution_time on our Linux Shared Server is 30 seconds. We can set it to 60 Seconds...