Steps to change Document Root Folder to some Sub-folder using .htaccess

The following KB will help you to change the Document root folder for the add-on or sub-domains via .htaccess file under your cPanel account. If you are facing any issue with logging or accessing the cPanel account, do not hesitate to contact our 24/7 livechat support .

Step 1. Login to your Oryon cPanel account.
Step 2. Click File Manager option under Files.
Step 3. Go to the Document Root [home/username/public_html] directory.
Step 4. Kindly add the following lines in .htaccess in the public_html folder.

+++
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]
+++
Step 5. Replace domain-name.com with your actual main domain name.
Step 6. Replace folder-name with your sub-folder name that you wish to run instead of main domain.
Step 7. Finally Click Save Changes option.

Related Articles