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.

New to cpanel; How to set up websites in separate folders?

Discussion in 'General Discussion' started by Seapanel, Aug 5, 2012.

  1. Seapanel

    Seapanel Member

    Joined:
    Aug 5, 2012
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi,

    I'm new user of Cpanel and I need your help that will be much appreciated.
    I've installed a website in the root 'public_html' and now I need to add new websites in separate folder to get them organized as follow:

    Public_html >> Folder1 >>> site1
    Public_html >> Folder2 >>> site2
    Public_html >> Folder3 >>> site3
    etc..

    I contacted my host provider but he discouraged me to do it ! (I don't know it it was rightly or wrongly!). But I think organizing sites in separate folder is much more practical and easier to manage and backup.
    So, could somebody please tell me how to manage this issue and get my websites in separate folders?
    Is there any problem associated with such option?

    Thank you in advance

    Regards,
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    If you want your additional addon domains or subdomains in different folders, then that's how they are typically. Simply create the path you are wanting when you create the addon or subdomain in cPanel > Addon Domains or cPanel > Subdomains area in the Document Root field.

    Thanks!
     
  3. Seapanel

    Seapanel Member

    Joined:
    Aug 5, 2012
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Thank you very much, Tristan.
    So, I just need to move the files and folder to a new folder!
    It is quite simple!
    Will this imply any change (ex. database path) to update ?
    Eventual problems?

    Regards,
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Seapanel,

    If you have the files and folders for the addon domain in another folder currently, you'd have to move the contents to the new folder yes.

    If you have setup a database with the path to the prior folder, you'll have to change the configuration settings in the files for the script you are using.

    I'd suggest rather than moving the files and folders to copy them to the new location if you have sufficient space to do that. This way, the site or sites won't be down as you are making changes.

    Thanks!
     
  5. Seapanel

    Seapanel Member

    Joined:
    Aug 5, 2012
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Excellent idea, indeed, that I didn't think about!
    In this case, I have to add the main domain name as an addon, right?
    Have I to change the name domain to something else to be able to add it as an addon?
    Anyway, I'll test it by copying the files and folders and point the root addon domain to the new folder.
    I'll come back to tell you if things work fine!
    Meanwhile, if you have any advice or recommendation, please don't hesitate to share it with me!

    Thank you
     
    #5 Seapanel, Aug 5, 2012
    Last edited: Aug 5, 2012
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Seapanel,

    So you are wanting the main domain to be housed in a folder other than public_html as well? This would be better handled by moving the files to the subfolder and using a redirect in .htaccess to handle the main domain being located there. I would not suggest moving the main domain itself. The original request indicated this was for new websites within the main domain such as addon domains.

    It would make it unnecessarily complicated to not have the main domain itself in public_html but in a subfolder. You also cannot make the main domain an addon domain, since it is already configured on the account.

    Thanks!
     
  7. Seapanel

    Seapanel Member

    Joined:
    Aug 5, 2012
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Yes, I'd like to move the main domain to a separate folder too so I will have only folders inside the Public_html:

    public_html >> folder1>>site1
    public_html >> folder2>>site2
    etc

    This is cleaner and much easier for backup purposes, especially when I update a site more than another so I don't need to backup all the files and folders in the public_html root.
    I don't see what is the problem with such an option?
     
  8. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello Seapanel,

    The issue is that the document root for the main site isn't configurable by the end user of cPanel. Only the hosting provider can change that location and it requires manual configuration to do that such as editing a file in root SSH at /var/cpanel/userdata/username/maindomain.com location where username is the cPanel username and maindomain.com is the main domain name. Since you cannot revise that yourself, you are required to have your host change it. They might not be willing to do that.

    Instead, if you must make this change for the main domain, your only real option is to create a redirect for that specific domain to the folder it will be in using the .htaccess file in your public_html folder.

    Thanks!
     
  9. Seapanel

    Seapanel Member

    Joined:
    Aug 5, 2012
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Thanks Tristan.
    This is an important missed feature, alas!
    I've already asked my host provider and he told me that I have to pay $80 for the change or upgrade to VPS hosting!
    This is simply scandalous in my mind!
    They also told me that this is a Cpanel limitation, and thus I have to pay to get it done by their customization!
    I don't see the difference between a "main" domain and secondary domain in term of location since secondary domain work fine from a subfolder!
    Why the main domain shouldn't work too from a subfolder inside Public_html?

    Anyway, thanks for your answer.
     
  10. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    The main domain can work in the subfolder as I stated. The two options are to change the document root, which requires changes on the backend by the root user in SSH. The other option is to redirect using .htaccess by the end user (yourself in this case).

    You have to go with what is available and what works. I've given two options on how to do it. If the first isn't viable, then you'd have to go with the second that you can do. Once you've copied things into the subfolder, then start playing with .htaccess redirects for that main domain. You can read about them here:

    How To Redirect Your Domain To A Subfolder Using .htaccess | Site5 Webmaster Blog – Learn about all those internet tube things!

    Thanks!
     
  11. Seapanel

    Seapanel Member

    Joined:
    Aug 5, 2012
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Thanks, Tristan. I'll take a look on the link.
    Have a good day.
     
Loading...

Share This Page