Change the document root using .htaccess file

If you found this post helpful, kindly share it and show your support :)

The public_html directory is your Documentroot directory. Your website is loaded from public_html folder by default. If you have create a website under a sub-folder and you want to display it when you type the domain name, you will need to add the following lines to your .htaccess file.

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

You will replace domain.com with your domain name and replace folder with the folder having your website. In case if there is no .htaccess file under website, you can create a new .htaccess file using file manager in cpanel

Loading

Mohammed Noufal

I'm Mohammed Noufal, working as Server Admin for the last 10 years.  In my day-to-day life, l had to face different problems related to Web-hosting. On my website Errorlogz.com, you can find solutions for different Web-hosting-related problems. Sometimes, I spent hours searching/googling to find a solution. This inspired me to start a website that gives solutions to different Webhosting problems. This website includes basic Linux and windows commands, and different control panels like cPanel, Plesk, DirectAdmin, Webmin & so on. You can find solutions and or suggestions for different Web-hosting related problems from here. Hence I would like to say Errorlogz is your server protector.  I will be glad if Logdetect can help any one of the Server admins to find a solution to his problem.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *