In this Web Hosting Knowledge base article WebSouls technical team is assisting you on how to change your default document root directory;
Before knowing this let’s have brief look on .htaccess;
.htaccess files is configuration files used to manage the configuration of the Apache Web Server. By default document root directory is set to Public_html from where content your website is uploaded.
If you want to load the contact of your site from different directory kindly follow the steps given in the article below with the help of screenshots:
Step-1:
Login to your C-panel with your credentials.
Step-2:
Go to the File manager section.
Step-3:
Go to setting section at the top right corner in order to show dot (.) files or hidden files.
Step-4:
Select the "Document Root” for your domain and check "Show Hidden Files" (dotfiles). And click on save button.
Step-5:
Now find the .htaccess file, right click on .htaccess file and click edit from options.
Step-6:
You are in .htaccess file, paste the following code into the .htaccess file to change your document root 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]
Make sure to replace following code blocks:
Replace domain-name.com with your main domain name.
Replace folder-name with your directory path from where you want to load your site.
Step-7:
Now click on save changes button in the top right corner to save your .htaccess file.
All Fine. Here are the few simple steps to change your default document root directory. If this article helps enough don’t forget to hit the thumbs up button. WebSouls is always tried to make an ease for its customer and provides the best web hosting along with domain registration in Pakistan. If you are looking to buy an affordable web hosting in Pakistan than WebSouls is undoubtedly the right choice for you.
Team Technical Support
WebSouls