Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Change the path for root/default website

Discussion in 'General Discussion' started by albatroz, Jul 10, 2018.

  1. albatroz

    albatroz Well-Known Member

    Joined:
    Mar 6, 2003
    Messages:
    318
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Virtual Orbis / Peru
    cPanel Access Level:
    Root Administrator
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Jcats

    Jcats Well-Known Member

    Joined:
    May 25, 2011
    Messages:
    714
    Likes Received:
    120
    Trophy Points:
    168
    Location:
    New Jersey
    cPanel Access Level:
    DataCenter Provider
    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:
    Code:
    /var/cpanel/userdata/$cpuser/$domain
    SSL:
    Code:
    /var/cpanel/userdata/$cpuser/$domain_SSL
    You would want to change the line:

    Code:
    documentroot: /home/$cpuser/public_html
    Once you change the path, rebuild apache conf:

    Code:
    /scripts/rebuildhttpdconf
    and finally restart Apache:

    Code:
    /scripts/restartsrv_apache
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,835
    Likes Received:
    134
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    As an addition to @Jcats suggestion I would also run the following after editing the userdata files:

    Code:
    /scripts/updateuserdomains
    /scripts/updateuserdatacache --force
    And before rebuilding the httpd.conf.


    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. bearmatt

    bearmatt Registered

    Joined:
    Jul 30, 2017
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Sydney
    cPanel Access Level:
    Root Administrator
    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
     
  5. cPanelLauren

    cPanelLauren Forums Analyst
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    1,835
    Likes Received:
    134
    Trophy Points:
    118
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    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!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice