How to change Primary Domain landing folder?

kenzhin

Registered
Aug 16, 2011
3
0
51
a blessed day to all,

I'm hosting many domains on my hosting account. I want to organize my websites by putting them on separate folders on my public_html. How can I change my primary domain so that when i access www.primarydomain.com it will open the website in public_html/primarydomain but still in the address bar is www.primarydomain.com?

Another reason I need this is because example I put my second domain to public_html/seconddomain folder, i don't want anybody to access the second domain site by www.primarydomain.com/secondomain. i don't like also my public_html folder to be messy with all those website files. :D

Many thanks in advance.:)
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
You could avoid the addon domains and subdomains being in public_html entirely by ensuring WHM > Tweak Settings > public_html subdomains only is configured for the "off" setting.

If that is set to off, then when you create an addon or subdomain in cPanel > Addon Domains or cPanel > Subdomains area, simply change the "Document Root:" field to not have public_html listed. It will then create the addon or subdomain in /home/username/subfolder instead.
 

kenzhin

Registered
Aug 16, 2011
3
0
51
Thanks Tristan for your quick reply. I appreciate it so much..

But I'm just a normal cPanel user. This solution is not applicable for me. Any more solution my friend?

Thanks,
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Even as a normal cPanel user, do you show "Document Root:" field in cPanel > Addon Domains and cPanel > Subdomains areas? If you do, is the public_html/ folder path editable to remove it? If it is, then your host has allowed you to create subdomains and addon domains using /home/username/subfolder instead and you can use the suggestion provided to do that.

If you cannot remove public_html in the path for creating a new addon or subdomain, I would suggest asking your hosting provider if they would be willing to set that Tweak Setting to "off" in WHM, explaining why you would like that functionality.

Otherwise, you'll have to ask your hosting provider to put your main domain to point to a subfolder inside public_html, which is actually a less ideal setup.