Skip to main content

Disable access from subdomains

Comments

7 comments

  • cPanelLauren
    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.
    0
  • cicklow
    @
    0
  • Infopro
    This thread may be of some use to you:
    0
  • cicklow
    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.
    0
  • Infopro
    Hello, that does not solve my problem.

    If you add the new domain, outside public_html, I do think you'll achieve what you seek.
    when I add a new domain, a subdomain is created in example.com

    Unless you create it outside public_html. From the cPanel documentation: Tweak Settings - Domains - Version 68 Documentation - cPanel Documentation [QUOTE] Restrict document roots to public_html This setting prevents the creation of addon domains and subdomains outside of a cPanel user's primary domain's document root (the public_html directory within the user's /home directory). For example, if you enable this setting and then create the example.com addon domain, the system creates the /home/username/public_html/example.com directory rather than the /home/username/example.com directory. This setting defaults to On.
    0
  • cicklow
    my problem is not the public_html folder, my problem is to see my website from the subdomain. You can see the previous explanation.
    0
  • Infopro
    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!
    0

Please sign in to leave a comment.