Want to change the domain Moodle is installed on

Want to change the domain Moodle is installed on

by Hiten Vyas -
Number of replies: 6

Dear All,

I have installed Moodle on a VPN server which I have. I have installed it at the following domain: www.mydomain.com/moodle. You can login at this page.

However, I really want to install Moodle at www.mydomain.com - so that this is login page my users will see.

I just wanted to ask if there was an easy way to change the domain to which Moodle is installed on? Or would I need to uninstall moodle (at www.mydomain.com/moodle)  and re-install at the domain which I want (at www.mydomain.com)?

I'm not too technical and thought I would ask if there was an easy way to do this before I start uninstalling and re-installing again. It took me one whole day to install Moodle the last time.

I would be grateful for any advice or suggestions.

Take care,

Hiten

Average of ratings: -
In reply to Hiten Vyas

Re: Want to change the domain Moodle is installed on

by Larry Elchuck -
Simplest way is to just create an index.html file and place it at the root of your www or htdocs folder.

It should look like the attached file, if your moodle folder is indeed called moodle.

larry
In reply to Larry Elchuck

Re: Want to change the domain Moodle is installed on

by Richard Enison -
LE & HV,

That might work if all people ever do is type http://www.mydomain.com. But what if somebody decides that they want to make sure they get the right script, so they type http://www.mydomain.com/index.php or http://www.mydomain.com/install.php? Or maybe they want to do something fancy like http://www.mydomain.com/admin/replace.php. Not a good idea.

The usual solution, which has been posted in this forum many times, is to simply move the entire contents of the moodle folder (including all the subfolders, etc.) up one directory in the file system, then edit config.php in the root Moodle directory (which is now one higher than it had been) and change the wwwroot and dirroot lines accordingly. Finally, run http://www.mydomain.com/admin/replace.php in case there are any references to the old URL or pathname in the database that would need to be changed to the new. It should not be necessary to make any changes regarding the data directory, unless it was under the Moodle directory (which it shouldn't be unless the web host forces your hand), in which case the dataroot line in config.php would need to be edited also.

RLE
In reply to Richard Enison

Re: Want to change the domain Moodle is installed on

by Larry Elchuck -

Hi RLE

Re:That might work if all people ever do is type http://www.mydomain.com.
It does work ... I do it all the time

Re;But what if somebody decides that they want to make sure they get the right script, so they type http://www.mydomain.com/index.php or http://www.mydomain.com/install.php? Or maybe they want to do something fancy like http://www.mydomain.com/admin/replace.php. Not a good idea.

Admins should know better as to how to access the full url for admin tasks... it's really for the ease of access of non-admin users.

If a webserver is dedicated to Moodle only, what you suggest will work as well. I tend to want to have other apps running on my web servers that I do not want buried in my moodle folder, so I prefer to keep my moodle folder separate (especially for CVS updating purposes), yet making it the default url for the domain name.

To each his own!

cheers
L

Average of ratings: Useful (1)
In reply to Larry Elchuck

Re: Want to change the domain Moodle is installed on

by Richard Enison -
LE,

To each his own is right. Because the suggestion I made is not my first choice. It is, as I said, the most popular choice in this forum. My first choice is one that is only available to people and organizations with their own servers, not those using commercial web hosting services. Namely, leaving all the files where they are, and just editing the httpd.conf file (for Apache) or directory properties (for IIS), thus making the moodle directory the web document root.

I can see what you're saying about admins WRT http://www.mydomain.com/admin/replace.php. But I can easily imagine ordinary users reading the Moodle docs and typing http://www.mydomain.com/index.php or http://www.mydomain.com/install.php.

The last time this issue came up, I remember having a knock-down drag-out argument in this forum over whether to move the files or edit httpd.conf. I finally conceded, because users of shared hosting can't access httpd.conf, and because on Linux servers moving files only involves the directory entries, not the data itself. So now that I have joined the majority, I am still challenged over it. You just can't win.

RLE
In reply to Richard Enison

Re: Want to change the domain Moodle is installed on

by Larry Elchuck -
RLE

I agree with you on the httpd.conf option, if one controls his/her own server.

I usually set my servers up with all other domain names pointing to htdocs/folders using this method, while leaving the default htdocs/ (folder) alone with an index.html file that points to the /moodle folder.

Suppose. I could use the httpd.conf option for /moodle as well! lol. I like keeping an uncluttered root directory and applications in thier own, separate folders.

If one is on a hosted service with the domain dedicated to moodle only, the moving of the moodle folder is probably the best option, while the redirect option makes sense if there are other apps on the server or if one is looking for a quick-and dirty.

cheers
L



In reply to Richard Enison

Re: Want to change the domain Moodle is installed on

by Michael Helfield -
Hello RLE.

I tried doing your solution, since I have the same issue. I want my www.domain.com to be the moodle site. I moved the moodle directory up a directory and then edited config/php to have the root be domain.com and the root directory as well. When I tried to go to www.domain.com it was blank.

Any suggestions?

Sincerely,


MH