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!

how to get document root of every domain

Discussion in 'Workarounds and Optimization' started by dzamanakos, Oct 7, 2017.

  1. dzamanakos

    dzamanakos Active Member

    Joined:
    Feb 15, 2014
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    Hi, due to many records in apache error log (for example cant find 404.shtml in a site's doc root) i've added 403,404 etc files in cpanel3-skel folder for new accounts and i want to write a script that will copy the same files to existing domains.

    So i will :
    1. read the server's domains/subdomains/addondomains
    2. find the owner in order to chmod the files after the copy
    3. read the document root for every domain
    4. copy and chmod the files

    I can get the domains in a server and the owner by reading /etc/userdomains
    I cant find a file that contains the document root for the addon domains (or subdomains).

    Even though there are files in /var/cpanel/userdata/USERNAME/DOMAIN where i can extract the doc_root for the main domain very simple, the addon and subdomains files are not in the form of ADDONDOMAIN but in the form of ADDONDOMAIN.MAINDOMAIN, which makes the script difficult to build.

    are any other files that i can extract the document root of domains/subdomains/addondomains by knowing the domain/subdomain/addodomain name and the user that owns it?

    thank you in advance,
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,809
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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