The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

sub-domain - not sub-folder

Discussion in 'General Discussion' started by danis, Oct 20, 2008.

  1. danis

    danis Member

    Joined:
    Oct 19, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I am new to cpanel. I created a subdomain and the folder was placed in domain's public_html folder. When I try to browse it as a sub-folder, it works. i.e. both of these URLs work fine:

    http://example.com/subfolder/
    http://subfolder.example.com/

    How can I ensure that only subdomain works and the sub-folder does not work? (i.e. manully changing something in the already created subdomain and automatically via cpanel for all future subdomains?)

    Thanks
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    In the future, when prompted for where you wish to store the files for the subdomain, make sure the path does not contain public_html/. This will prevent users from accessing the website via example.com/subfolder.

    If you do not see this prompt for where to locate your files - please ask your hosting provider to switch you to the x3 theme.
     
  3. forum17

    forum17 Active Member

    Joined:
    Mar 30, 2007
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    0
    Or simply create folder as subfolder under your home directory and upload data of subdomain to this new directory and then ((suppose your cpanel username is example)) ask your hosting provider to change document root of your subdomain from /home/example/public_html/subfolder to /home/example/subfolder :)

    Regards,
    Angelo S.
     
  4. danis

    danis Member

    Joined:
    Oct 19, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Thanks Angelo & David.

    appreciate the help.
     
  5. danis

    danis Member

    Joined:
    Oct 19, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I do see this prompt as soon as I click in the input box for document root. I don't click, I don't see that. So, this is PERFECT. I will use it for future. For the subdomain, which is already created, is there a way to change the document root and move it outside public_html?
     
  6. nwbach

    nwbach Member

    Joined:
    Nov 24, 2006
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Understanding the subdomain and getting only it to show

    Ok, I'm just trying to understand a situation with my new subdomain. What I want is the subdomain to ALWAYS show, not the directory that it is pointed at.

    Thus if I have:

    subdomain.domain.com

    and it points to:

    domain.com/subdomain_directory

    I only want the address bar in the browser to show:

    subdomain.domain.com

    So, if I'm understanding this correctly, I can make this happen by creating
    the subdomain directory OUTSIDE the public_html directory? I also read where something can be accomplished with cPanel X2. What does this mean?

    Sorry, I'm a little thick when it comes to understanding these things.
    :confused::confused:
     
  7. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    When you create a subdomain using the Subdomains feature of the cPanel interface, it will display subdomain.example.com rather than example.com/subdomain regardless of where the directory is located if you visit subdomain.example.com. If that is not happening, you may wish to contact your hosting provider for assistance.

    If you don't want to be able to access the site via example.com/subdomain - that is a different scenario. You can accomplish that by placing your files outside of public_html (for example: subdomain/). This can only be done with the x3 theme. If you are not using the x3 theme, please have your hosting provider upgrade your theme.

    The x2 and x themes are old themes from old versions of our software and they are no longer maintained. They will become fully deprecated in cPanel version 12.
     
Loading...

Share This Page