cPanel – How to put all Domains in the same Folder

December 11th, 2008

cpanelIf you’ve ever used cPanel you probably know that each account is tied to a default domain for that account.. you can add more domains to each account but these will be seen as additional domains..
This idealogy has always annoyed me.. because it also means that your default domain is bound to the public_html folder and all other domains can have either that folder or any sub folder as it’s homedir.. but I want all my domains in the same folder, not one “default” domain as the main folder and put all other domains in a subfolder of that domain.. where’s the logic in that?

So I used htaccess to have mod_rewrite redirect the main domain to the “domains” folder… which is the same folder all my other domains use, this way I can have things the way I like.

Here’s the code that you put right inside your public_html folder;

<IfModule mod_rewrite.c>
RewriteEngine On
ReWriteCond %{HTTP_HOST} naatan.com
ReWriteCond %{DOCUMENT_ROOT} !domains/
ReWriteCond %{DOCUMENT_ROOT} !subdomains/
ReWriteRule ^(.*)$ domains/naatan.com/$1 [L]
</IfModule>

Of course you’re gonna want to replace naatan.com with your domain..

Read the rest of this entry »