[sg_popup id=”2″ event=”onload”][/sg_popup]How to change document root? This will help if you want to change the document root of you website from the default location.
By default the document root of your website on a cPanel based server is /home/$username/public_html . At the time anyone search your domain from there own end the site displays the index page or the content from this default location. That means from public_html folder. So How to change document root?
How to migrate all cPanel accounts without its home directory?
Yeah, definitely! You can create a complete cPanel account backup by excluding the home directory. This is very important, because, if the home directory of cPanel accounts have large amount of data, this will increase the total time for the account migration.
Generating backup and restoring it for a large account is much time consuming process. If you need a faster solution, exclude the home directory then complete the account migration with out its home directory. After that start syncing the home directory from source to destination server 🙂
How to change document root
In this blog article, I’m explaining the way to change this default root folder of a hosted website on a cPanel server. cPanel using HTTP as web server. That means you can customise the DNS fetching(Index page fetching) from your own folder.
This is possible via .htaccess. You will need to add the following code in 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]
Replace ‘domain.com‘ with your domain name and ‘folder‘ with your custom folder name where you kept the index.
Thats it. Try this and reply me.
Now you can configure your cPanel backup to Google Drive!!
They introduced this feature in its latest version, now onward from version 66. Please make sure that your server has the latest version of cPanel software.
You can check the version by running the following command as root.
It did not work
I am using my local development environment to test my application.
Suppose I have a website on:
localhost:8888//folder/subfolder/public/index.html
Now in the public folder I have an HTAccess file.
If I put a “/” inside an href, I want it to go to index.html not the actual Document root,
Why am I finding it so difficult?