What I want to do is unload my moodle code into a nice, organized file structure within my "File Manager" on cPanel." The end result should be that I can put my moodle code here:
public_html/moodle
public_html_moodledata
And still reference my site like this: www.mysite.com
(instead of normally having to extend the url like: www.mysite.com/moodle/)
Since I have root ssh access on my server, I am going to edit where the documentroot points to.
Login to SSH
Since I'm using a windows machine to access my server, I went ahead and downloaded PuTTY, a free ssh client.
- I opened up putty and input my server's IP address.
- I logged in as the root user.
- If logged in as another user, use the command su - command to enter root password and gain root access.
- Now we need to open and edit your domain file. Again, you can only do this as root user. Type in the following command: vi /var/cpanel/userdata/USERNAME/DOMAINNAME
- An example would be: vi /var/cpanel/userdata/testuser/mysite.com
- Now the file should be open within PuTTY. Click the "i" key to start editing mode, and use arrows to navigate to the section of text called "documentroot."
- Change that text to say: documentroot: /home/testuser/public_html/moodle
- Rebuild the Apache conf and restart Apache. You can do this through SSH:
- /scripts/rebuildhttpdconf
- service httpd restart
- Or through the WHM panel. Type in the search bar "Apache Config". Go to the page.Save and rebuild.
- The change will be immediate. Simply clear your browser cache and force refresh the page!
I used this blog guide as a reference:
http://blog.servint.net/2012/03/30/the-tech-bench-changing-a-document-root-in-cpanel/