1. Home
  2. Knowledge Base
  3. cPanel
  4. How to change document root folder to some subfolder using .htaccess file

How to change document root folder to some subfolder using .htaccess file

Step1: Login to the server and edit .htaccess file

Step2: Replace domain-name.com with your actual main domain name and replace folder-name with your sub-folder name.

+++
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]
+++

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support