Subdomain and Document Root Help

Operating System & Version
CloudLinux

sidcaan

Registered
Apr 19, 2020
3
0
1
Internet
cPanel Access Level
Root Administrator
Hi,

I’m having some problems and wondering if anyone can help me please.

I have setup the following subdomain with the document root:
clients.domain.tld > /public_html/clients

I want the content to be only available via the URL “clients.domain.tld” but right now it is also accessible via the URLs “www.domain.tld/clients” and “domain.tld/clients”. How can I disable the latter 2 URLs so that it is only possible through the subdomain only?

Thank you.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
So those latter two URLs are present because the folder for the subdomain exists inside the root domain's document root. The only way to avoid this would be to move the data outside the document root - so outside of public_html and into /home/$user/
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
It is possible but it may be that your provider has restricted document roots to public_html which is a setting that can be changed in WHM's Tweak Settings interface. Otherwise, it's not possible to do as far as I am aware - besides redirecting domain.tld/folder to sub.domain.tld which is possible to do in the cPanel interface.