Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Oct 2008
    Posts
    6

    Default sub-domain - not sub-folder

    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. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by danis View Post
    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
    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. #3
    Member
    Join Date
    Mar 2007
    Posts
    29

    Default

    Quote Originally Posted by danis View Post
    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
    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.
    http://midnight-cafe.co.uk

  4. #4
    Member
    Join Date
    Oct 2008
    Posts
    6

    Default

    Thanks Angelo & David.

    appreciate the help.

  5. #5
    Member
    Join Date
    Oct 2008
    Posts
    6

    Default

    Quote Originally Posted by cPanelDavidG View Post
    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.
    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. #6
    Member
    Join Date
    Nov 2006
    Posts
    6

    Default 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.

  7. #7
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by nwbach View Post
    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.
    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.

Similar Threads & Tags
Similar threads

  1. Sub domain from folder to sibling folder
    By opolychr in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-10-2011, 07:13 AM
  2. Can I point a parked domain to a folder on the main domain?
    By rligg in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 04-04-2008, 12:12 PM
  3. Domain fwd to another domain.com/folder
    By hostmedic in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 06-12-2005, 09:04 PM
  4. Addon Domain and sub/sub folder
    By LBJ in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-07-2005, 11:17 PM
  5. park a domain to a folder
    By Hedloff in forum New User Questions
    Replies: 1
    Last Post: 06-08-2004, 04:38 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube