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!

Changing directory structure for all domains?

Discussion in 'EasyApache' started by ipublicis, Apr 27, 2018.

  1. ipublicis

    ipublicis Registered

    Joined:
    Apr 27, 2018
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lisboa, Portugal
    cPanel Access Level:
    Root Administrator
    Hi all,

    I didn't found exactly the info I need.

    On our new server we need to have the following structure instead of the current one.
    We don't understand too much about EA or Apache so, please, give us a guided hand :D

    We need that when we create a new user the structure would be like this:

    /home/[username]/[domain]/public_html

    Also any subdomain or addon domain should follow a similar structure, i.e.:

    /home/[username]/[domain_addon_or_subdomain]/public_html

    Where the [domain]/public_html or [domain_addon_or_subdomain]/public_html could be changed by hand at CPanel)

    This should be done at new user or new domain creation and not at the command line afterwards.

    Is it possible? How?

    Thanks a lot for any help.

    Lopo

    Found this at [removed - external URL] but this is to change afterwards and not on creation and automatically.
     
    #1 ipublicis, Apr 27, 2018
    Last edited by a moderator: Apr 30, 2018
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @ipublicis,

    First, note that for subdomains or addon domain names, you can turn off the following option under the Domains tab in WHM >> Tweak Settings:

    Restrict document roots to public_html

    This will allow customers to setup subdomains and addon domain names with a document root outside of the public_html directory at the time they are created.

    As far as the primary domain name, there's currently no feature that will allow you to modify the default document root setting for the domain name utilized during account creation. I encourage you to vote and add a comment to the following feature request to note that you'd like such a feature to include the ability to modify the default document root:

    Allow users to change the DocumentRoot

    As a workaround, you can use the following steps to modify the default document root for the domain name utilized at account creation time:

    1. Update the "documentroot" value to the new path in the following files:

    /var/cpanel/userdata/username/domain.tld
    /var/cpanel/userdata/username/domain.tld_SSL

    2. Remove the existing cache files:

    Code:
    rm /var/cpanel/userdata/username/domain.tld.cache
    rm /var/cpanel/userdata/username/domain.tld_SSL.cache
    3. Rebuild the cache files and the Apache configuration file:

    Code:
    /scripts/updateuserdatacache
    /scripts/rebuildhttpdconf
    4. Restart Apache:

    Code:
    /scripts/restartsrv_httpd
    If you want this to happen automatically, then you'd need to develop a custom bash script that performs the above steps and then configure the custom bash script to run automatically during the account creation process using a post "Accounts::Create" hook. Here are some documents to help you get started should you want to set that up:

    Guide to Standardized Hooks - Software Development Kit - cPanel Documentation
    Guide to Standardized Hooks - Whostmgr Functions - Software Development Kit - cPanel Documentation

    We provide a list of companies offering system administration services on the following URL if you need help developing the custom bash script:

    System Administration Services | cPanel Forums

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    ipublicis likes this.
  3. ipublicis

    ipublicis Registered

    Joined:
    Apr 27, 2018
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lisboa, Portugal
    cPanel Access Level:
    Root Administrator
    With just 24 request when do you think this feature will be available?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @ipublicis,

    A significant number of votes certainly helps bring attention to a feature request, but it's not the only factor we use when determining which features to implement. We don't have a specific time frame to offer on when we'll add this specific feature to the product (if it's accepted). Voting for the request will automatically subscribe you to it so that you will receive email updates on the status of the feature as they occur. I also encourage you to add a comment to the request explaining why you'd like to see this feature implemented in the product.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    ipublicis likes this.
  5. ipublicis

    ipublicis Registered

    Joined:
    Apr 27, 2018
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Lisboa, Portugal
    cPanel Access Level:
    Root Administrator
    Hi

    I think you have a misspeling at 1. or 2. because it doesn't seem correcto to me removing the file I just change :)

    Thnaks in advance.

    Lopo
     
    #5 ipublicis, May 3, 2018
    Last edited by a moderator: May 3, 2018
    cPanelMichael likes this.
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @ipublicis,

    Good catch! I've edited that post to reflect the correct location to the cache files.

    Thank you.
     
    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