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.

Changing base directory

Discussion in 'General Discussion' started by Julien PHAM, Jul 10, 2009.

  1. Julien PHAM

    Julien PHAM Active Member

    Joined:
    Jul 9, 2009
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Is there a way to setup cpanel to use another base directory than the default public_html one?

    I need this because my CMS uses another base one, so I need to point my website base directory to another one.

    Thanks
     
  2. JawadArshad

    JawadArshad Well-Known Member
    PartnerNOC

    Joined:
    Apr 8, 2008
    Messages:
    447
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    PK
    cPanel Access Level:
    DataCenter Provider
    I recommend you not to change the default path, unless you really have to do it. If you still need to do it, here is how to.

    1- Edit the document root of a site by editing the '/var/cpanel/userdata/user/domain.tld file

    2- Change the 'documentroot: /home/user/public_html' to your specified path, save the file and run this command.

    3- /scripts/rebuildhttpdconf

    4- Restart Apache.
     
  3. Julien PHAM

    Julien PHAM Active Member

    Joined:
    Jul 9, 2009
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    This is not the default path for all users I would like to change, this is the base path for my account I need to change.

    I explain, I use drupal CMS. Drupal installs itself in /home/username/public_html/drupal directory.

    But I do not want to have to use as web address : http://www.mydomain.com/drupal, but instead just http://www.mydomain.com

    Do you understand what I mean?

    So how can I achieve this?

    Thanks

    Edit :
    I have found this on those forums, is it the same thing?

    1. Locate the domain you're trying to edit in /var/cpanel/userdata/user
    2. Edit your file
    3. Run /scripts/ensure_vhost_includes --user=USER
     
    #3 Julien PHAM, Jul 10, 2009
    Last edited: Jul 10, 2009
  4. linux7802

    linux7802 Well-Known Member

    Joined:
    Dec 14, 2007
    Messages:
    232
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Solution

    If you are having root login details the you can change the
    DocumentRoot for your domain in /etc/httpd//conf/httpd.conf file

    So that after browsing the URL http://www.mydomain.com/ it will show content of drupal

    OR

    If you are not having server access then please contact your domain hosting provider and ask them to change the DocumentRoot for your domain.
     
  5. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    There is NO SUCH THING as a CMS that can't use /public_html or
    otherwise run at your main domain name instead of a subfolder! ;)

    Sounds more to me like you don't know what you are doing or otherwise
    don't know how to install your CMS program correctly!

    There is absolutely no need to change the layout of your web hosting
    account, update file folder names, or anything of the sort and it is
    absolutely ridiculous to suggest that you do! :rolleyes:

    If you would like some assistance setting up your CMS program,
    I'd be glad to give you a hand with that but you don't need to go off
    trying to change account folder names and such! LOL :D

    If you are installing Drupal automatically from Fantastico Deluxe, just simply leave the install location blank
    and it will install directly to your site root instead of "/drupal" which is what you are asking anyway!

    If you are downloading the drupal archive and installing manually, you just simply unpack the archive
    directly to the main /public_html folder and then go and run your standard setup and installation.
     
    #5 Spiral, Jul 11, 2009
    Last edited: Jul 12, 2009
  6. Julien PHAM

    Julien PHAM Active Member

    Joined:
    Jul 9, 2009
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    Not at all, you do not understand...
    First, I was finally able to put the base directory where I want to, in /home/username/public_html/drupal

    Why I did that? Because it makes the upgrades of my CMS far more easy. Let me explain.

    I have created a drupal directory in /home/ In this drupal directory I put the different versions of drupal, such as drupal.6-11, drupal.6-12, and so on.

    In /home/username/public_html, there is no drupal directory, the drupal is just a symbolic link that points to /home/drupal/drupal version

    This way, when I upgrade drupal, I just have to unzip/untar the new drupal version in /home/drupal and to change the symbolic link to point to the new drupal version.

    I find it far more convenient than having to delete all files in the public_html folder then install the new drupal version and move the files elsewhere. (as by default untar the drupal puts it in a subfolder of the current folder)

    And this way this is easier to go back to a previous drupal version if something goes wrong while upgrading...

    Same thing with the sites folder, it is just a sym link so I do not have to keep this folder in the public_html folder. I prefer to have it elsewhere. And so if I need to I can delete all public_html folder without deleting my datas...
     
    #6 Julien PHAM, Jul 11, 2009
    Last edited: Jul 11, 2009
  7. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Who said anything about deleting any files? :rolleyes:

    What in the world ?????

    Nice improvising on the symlink but if you think you have to delete files or take all those ridiculous extra steps to upgrade your Drupal installation, then the other part of my previous post statement truly does apply:
    And then you say ...
    I understand perfectly and I know how to install Drupal just fine!

    It's clearly you who doesn't understand much per your own posts! :D

    Now if you need help installing (or upgrading) without so many weird extra steps, i'd only be too glad to assist ...

    Otherwise, or if you prefer, go on ahead and take 10 extra steps doing things you don't have to do, and making a lot more work for yourself in the ironic name of "making things easier"! There is no need to create extra folders, use symlinks however creative that might be, or delete any files and, the original topic of this thread -- IE: changing your account's home path which is not recommended in general under normal circumstances and especially so when there is no practical reason to do any of that in the first place! :rolleyes:

    Incidentally, you do know you can extract the files from both TAR and ZIP archives without the folders, right?
     
    #7 Spiral, Jul 12, 2009
    Last edited: Jul 12, 2009
  8. Julien PHAM

    Julien PHAM Active Member

    Joined:
    Jul 9, 2009
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    And what about going back to previous version? With my solution you just have to change the symlink. With your solution you have to install back the previous one. I prefer my method.

    And moreover, perhaps you do not have to delete old files, but I prefer to have a clean drupal directory. So imagine if from one version to another there are some files that are not needed anymore, if you just install new drupal to the same directory, those files will still be there. Not needed but still be there. And the new drupal installation will override old files, so if I want to check how the old files look like, it is less easy.

    I know what I'm doing, but I prefer this symlink method. I prefer to separate the drupal install directory from the sites drupal folder as well.

    Before using drupal I used typo3. Typo3 used symlink a lot, and I found this very convenient. And so when I migrated to drupal I kept this symlink method.

    I prefer a new, fresh drupal install when I migrate to a new drupal install than overriding old files.
     
  9. odox

    odox Registered

    Joined:
    Sep 29, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I have the same issue with Cpanel and Drupal (warning : newb)

    The drupal site is running on www.mydomain.com/drupal

    I'd like it to run on www.mydomain.com

    At the moment i've just got it forwarding to the /drupal.

    Can someone provide me with simple steps on how to do this?

    Thanks in advance :)
     
  10. 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
    The questions posted to this thread do not seem to be cPanel/WHM-specific.

    You may receive faster responses specific to Drupal from Drupal experts if you post to the Drupal forums. Those forums are located at: http://drupal.org/forum
     
  11. votethehost.com

    votethehost.com Active Member

    Joined:
    Oct 2, 2009
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chicago
    I agree to cPanelDavidG that this is not a cpanel related question but then also I would like to add something to this. Any php application like, durpal, phpbb etc have two important things, one is the configuration file and other is database. When you install any php application the document root of the application (location where application is installed can be public_html or even a sub directory under it) is recorded in configuration files and even sometimes in database attached to it. If you need to change drupal installation from a sub directory to public_html directory you have to do following things:

    first copy all files from the sub directory to directly under public_html, now check the config file of drupal and see where you can change the installation path also if any entry for path is in database then you have to edit it. (Generally its not in database but mostly in config file)

    Its a bit tricky thing to do but if you have a little idea of drupal files then it is possible.


    Thanks.
     
  12. linux25

    linux25 Member

    Joined:
    Oct 6, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Folder other than public_html

    First, this is a cPanel issue because without cPanel, you just set the DocumentRoot in httpd.conf.

    Second, Spiral needs to SFTU. This is a forum for cPanel newbies. Bashing people in here helps no one. I guess it helps your self-esteem, Spiral, but get a life. And you don't know what is ridiculous. Every admin has a different need and a different configuration. If you are such an expert, you would know that.

    No one looked to see what the real answer here is.

    To do what Julien PHAM is trying to do, create a file "/usr/local/apache/conf/userdata/std/2/accountname/sitename/accountname.conf". Replace 'accountname' and 'sitename' with the cpanel account name and the website name. In the file give the DocumentRoot directive for the site. Then run /scripts/rebuildhttpdconf. Then restart Apache.

    If you go to edit /etc/httpd/conf/httpd.conf you will find the instructions near the virtual host settings for the host you are trying to modify.
     
Loading...

Share This Page