Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Disable access from subdomains

Discussion in 'General Discussion' started by cicklow, Jun 7, 2018.

  1. cicklow

    cicklow Registered

    Joined:
    Jun 7, 2018
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    -
    cPanel Access Level:
    Root Administrator
    Hello, I have as main domain (it is an example) domain.com, when adding a new domain a subdomain is created (example) name.dominio.com (for name.com), but if I access name.dominio.com it shows me the name.com website.

    How do I prevent the subdomains of the main cpanel domain from showing web sites?

    From cPanel -> domains-> zone editor-> domain.com I can see all the subdomains of the created domains. If I eliminate them, will it bring me a problem? or how can I block access (or visualization) of the subdomains.
     
  2. cPanelLauren

    cPanelLauren Forums Analyst II
    Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    3,806
    Likes Received:
    275
    Trophy Points:
    193
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @cicklow

    When you create an addon domain the subdomain is automatically created, this is what allows you to create an addon domain. The addon domain is ultimately just an alias for the subdomain and shouldn't cause an issue.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cicklow

    cicklow Registered

    Joined:
    Jun 7, 2018
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    -
    cPanel Access Level:
    Root Administrator
    @cPanelLauren Hi, thank you for you answer. but how do I block access to the subdomain? so avoid having my websites viewed from name.primarydomain.com or primarydomain.com/user/folder
    only access from name.com
     
  4. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,565
    Likes Received:
    438
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cicklow

    cicklow Registered

    Joined:
    Jun 7, 2018
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    -
    cPanel Access Level:
    Root Administrator
    Hello, that does not solve my problem. I'll try to explain myself better.
    I have as main domain in cpanel: example.com, when I add a new domain, a subdomain is created in example.com, example if I add the domain example.net, the subdomain is created: example.example.com.

    My problem is that if you access example.example.com you are viewing the site example.net.

    Now my question is: how do I block access to example.example.com and leave true access to example.com

    I know I can do it with .htaccess, but I have many domains. And I have to create a .htaccess for each domain, redirecting the subdomain to the original domain.
     
    #5 cicklow, Jun 8, 2018
    Last edited by a moderator: Jun 9, 2018
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,565
    Likes Received:
    438
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    If you add the new domain, outside public_html, I do think you'll achieve what you seek.

    Unless you create it outside public_html.


    From the cPanel documentation:
    Tweak Settings - Domains - Version 68 Documentation - cPanel Documentation

     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. cicklow

    cicklow Registered

    Joined:
    Jun 7, 2018
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    -
    cPanel Access Level:
    Root Administrator
    my problem is not the public_html folder, my problem is to see my website from the subdomain. You can see the previous explanation.
     
  8. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,565
    Likes Received:
    438
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    If your main domain is, example.com, it is, public_html of course. If you want to add an addon domain, example.net, and you change the doc root when creating example.net to be /, then it will not be accessible from example.example.com

    You cannot view the addon domain as a subdomain, if you change the doc root of the addon domain to be, /, on creation.

    HTH!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice