Configure Add-On domain's document root to be relative to my account's home dir

r_honey

Member
Aug 1, 2009
5
0
51
My Hosting provider allows me to add multiple Add-on Domains in addition to the main domain.

I enter the following in the Add-On domain page:
New Domain Name: example.com
Document Root: /example.com

(Other details are not relevant to this thread).

However, to my surprise, cpanel creates 2 directories in my Hosting space's root directory:
/example.com
/public_html/example.com

However, the second one (/public_html/example.com) is the actual document root.

This creates multiple problems for me (not to mention that a domain root should not be inside another's domain root logically), like when I backup the main domain files, Add-On Domain files are also backed up, a user having FTP access to main domain's root can change any add-on domain's files.

So, is there any way to configure /example.com as the root for the add-on domains??
I am using cPanel Accelerated!!
 

JawadArshad

Well-Known Member
PartnerNOC
Apr 8, 2008
459
7
68
PK
cPanel Access Level
DataCenter Provider
My Hosting provider allows me to add multiple Add-on Domains in addition to the main domain.

I enter the following in the Add-On domain page:
New Domain Name: example.com
Document Root: /example.com

(Other details are not relevant to this thread).

However, to my surprise, cpanel creates 2 directories in my Hosting space's root directory:
/example.com
/public_html/example.com

However, the second one (/public_html/example.com) is the actual document root.

This creates multiple problems for me (not to mention that a domain root should not be inside another's domain root logically), like when I backup the main domain files, Add-On Domain files are also backed up, a user having FTP access to main domain's root can change any add-on domain's files.

So, is there any way to configure /example.com as the root for the add-on domains??
I am using cPanel Accelerated!!
Well this shouldn't happen since you define documentroot as /example.com, however once created, you can do this to change documentroot.

1- edit the file /var/cpanel/userdata/user/example.yourdomain.com and change document root to /home/user/example.com
2- /scripts/rebuildhttpdconf
3- Restart Apache.
 

r_honey

Member
Aug 1, 2009
5
0
51
Well this shouldn't happen since you define documentroot as /example.com, however once created, you can do this to change documentroot.

1- edit the file /var/cpanel/userdata/user/example.yourdomain.com and change document root to /home/user/example.com
2- /scripts/rebuildhttpdconf
3- Restart Apache.
I could not find /var directory in my Hosting space. Also, a search for any directory named userdata or user also returned nothing.
 

InstaCarma_Tech

Well-Known Member
Apr 22, 2009
227
1
68
I could not find /var directory in my Hosting space. Also, a search for any directory named userdata or user also returned nothing.
To have access to the above files, you need to be 'root'
From your comments , I assume that you are on a shared hosting server. hence, you should contact your provider for the changes to be made.

However, I should add that 'add-on' domains are used to point to a sub-directory within the main domain. So, the doc-root will be located inside public_html by default.
 

r_honey

Member
Aug 1, 2009
5
0
51
To have access to the above files, you need to be 'root'
From your comments , I assume that you are on a shared hosting server. hence, you should contact your provider for the changes to be made.
Yes, I am on Shared Hosting. And I have contacted the provider. I thought this could be managed from CPanel though.