SOLVED How do I change the default directory of domains?

bb_simon

Registered
Dec 13, 2016
2
0
1
Sweden
cPanel Access Level
Root Administrator
Hi all,

I've been looking around for information on this but can't find what I'm looking for.
What scripts do I need to modify to have VHM create directories like these by default:

/home/<user>/<primarydomain>/public_html
/home/<user>/<addondomain>/public_html
/home/<user>/<subdomain>/public_html

On top of that I'd like the following directories created for each of the above:

/home/<user>/<domain>/sessions
/home/<user>/<domain>/logs
/home/<user>/<domain>/tmp_upload_dir

And of course set up the vhosts accordingly.
 

bb_simon

Registered
Dec 13, 2016
2
0
1
Sweden
cPanel Access Level
Root Administrator
I find so many discussions about this - old as new - but no solutions. There gotta be some (hacky) way to do it right?

After reading more I guess it could be summarized as: I need the primary domains of my users to be treated like addon-domains.

Anyone? What is the solution?

According to a cpanel-worker(?) this has been implemented (Addon domains created at account root as a folder) but I cant find a trace of it in Tweak Settings.
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,215
363
Hello,

This will require a custom application that utilizes a standardized hook:

Guide to Standardized Hooks - Software Development Kit - cPanel Documentation

You'd need to first develop a script that creates the directories of your preference and makes the changes to the documentroot outlined on threads like this. Then, configure the custom script to run at the post account creation stage of the Accounts::Create hook documented at:

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

Note the feature referenced in your last response is intended for addon and subdomains, not new accounts.

Thank you.