Change the path for root/default website
Hello,
I am in a situation where I would liket to load a web site from a folder different to /public_html/
I was wondering if there is an option inside CPanel to change the default path for a website
-
Yes but keep it in the same cPanel account otherwise you'll have issues, you also need to modify 2 files if the site is running over SSL: Non SSL: /var/cpanel/userdata/$cpuser/$domain
SSL:/var/cpanel/userdata/$cpuser/$domain_SSL
You would want to change the line:documentroot: /home/$cpuser/public_html
Once you change the path, rebuild apache conf:/scripts/rebuildhttpdconf
and finally restart Apache:/scripts/restartsrv_apache0 -
As an addition to @Jcats suggestion I would also run the following after editing the userdata files: /scripts/updateuserdomains /scripts/updateuserdatacache --force
And before rebuilding the httpd.conf. Thanks!0 -
Hi, I am also struggling to achieve loading a different Default webpage (from same Server/Cpanel account) Excuse my ignorance, but will the above solution stick after new versions, because I thought that we had to use Include Files ? Thanks, Matt 0 -
HI @bearmatt For this modification changing the userdata files shouldn't be overwritten but it is a customization and it's not supported by cPanel, this just means that while it can be done and many others have done it we don't guarantee it will function as intended forever. This is the only way to achieve what you're looking to do though. Include files are in the respect you're thinking are more for apache configuration changes directly. Because we pull data for VirtualHosts from the userdata files you are essentially modifying an existing include. Thanks! 0
Please sign in to leave a comment.
Comments
4 comments