motionhosting

Member
Oct 25, 2005
7
0
151
Hi,
Is it possible with CPanel to have the user's web space organized differently? For example
/mail/
....
/public_html/
|
|---- /public_html/domain.com/index.html
|---- /public_html/subdomain.domain.com/index.html
|---- /public_html/another-domain.com/index.html
....

I tried looking at the scripts directory but the $home/public_html/ path seems to be hardcoded in all scripts :mad:

I couldn't find the actual script that creates the user's web space. The realadduser simply creates the user's directory in the home directory, but the actual public_html is not in this script or is it using the skeleton directory to create the public_html? If it does so then it is very unreliable, because I can change in the skeleton directory the name of the public_html directory and all scripts will stop working then, so I guess the skeleton directory's structure refers to an already created public_html directory.

Has anybody tried this? Don't you think it is a much better organization of the user's web space? If I could change it I would just create a www directory in the user's home directory where I would list all of the domains and sub-domains hosted with this account and each being a directory would point to the web content of the relevant domain/sub-domain.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,453
31
473
Go on, have a guess
Well, you're restricted to the naming policies that cPanel uses. If you want to play with new account creation you would need to look at /scripts/wwwacct which is the script used when new accounts are created. Alternatively, you could modify the VirtualHost containers retrospectively in httpd.conf. However, it's probably simpler to just get used to the scheme cPanel uses. IMO, there's nothing particularly wrong with it.
 

nfh

Registered
Nov 25, 2005
3
0
151
Hello,

I registered myself in this forum because of this particular question. In my case what I would like to have is this:

/public_html
|--- /domain/www/index.html
|--- /domain/subdomain/index.html
|
|--- /addon/www/index.html
|--- /addon/subdomain/index.html


in order to solve these problems:

1st problem
if you have:

public_html/ -> www.domain.com
public_html/subdomain/ -> subdomain.domain.com

and if someone tries to access the www.domain.com/subdomain address he/she will be able to access the subdomain through the www address.

2nd problem
if you have:

public_html/ -> www.domain.com
public_html/addondomain/ -> www.addondomain.com

and if someone tries to access www.domain.com/addondomain address he/she will be able to access the addon domain through the main domain (domain.com).


Isn't there really nothing one can do in order to solve this? I would suggest two things: instead of having the virtual host DocumentRoot point to /public_html/, point it to a user specified directory. This way the user could define his/her own directory organization and create something like the structure I want to have on my websites through a single account.

Best regards,
Norberto
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,453
31
473
Go on, have a guess
You can resolve all those issues by using mor_rewrite rules in a local .htaccess file in each of the sub folders that checks the HTTP_HOST environment variable and rewrites the URL if it is not set to what you want it to be.
 

nfh

Registered
Nov 25, 2005
3
0
151
Currently I have some rewrites on .htaccess in order to simulate what I want (basically I have the public_html/.htaccess redirecting to public_html/maindomain/www) that solves the problems I mentioned. Nevertheless I'm not sure if this redirection can be visible on the browser (or at least at the HTTP header), and what I really want is it to be transparent, just as if there isn't any HTTP redirection (specifying the exact directory for each domain or sub-domain would not imply any redirection at all).

And the fact that a cPanel user isn't allowed to specify the exact directory for an addon domain or a sub domain (including the www one) can originate another problem, as described on this thread.

Basically what I'm suggesting is for you to consider this as a feature request. The creation/modification of sub-domains and add-on domains imply a httpd.conf modification in the first place, so asking the user which directory does he wants to use will not be a problem, as long as you prevent him from choosing a directory outside public_html. This way it would be way much easier to organize websites, whether the account is used to store multiple sites or it is used to store multiple indepentent subdomains.

Of course I could go and ask my hosting service to modify the httpd.conf in the first place, but to start with I guess this can generate some confusion on cPanel, and I don't really appreciate the idea that I have to keep asking my hosting service everytime I want to create or modify my directories.
 
Last edited:

nfh

Registered
Nov 25, 2005
3
0
151
Thank you very much for pointing me to that thread.
In the meantime I went to bugzilla and I did some search in order to find similar requests. It seems I'm not the only one needing this, and although there are several similar requests, I decided to back up this one:

http://bugzilla.cpanel.net/show_bug.cgi?id=1898

I contributed with the explanation I already placed in here, and I hope my message was clear enough so that the developers can see what I really would like to have.

Best regards,
Norberto