External hosting and paths

External hosting and paths

by Matt Dymond -
Number of replies: 11

(Moodle 2.02+ build 20110223)

We've needed to migrate our Moodle to another web host.
Unfortunately, I have minimal knowledge of moodle (site was built on the prev hosting by someone else - e.g. the basic install was provided & they just used the web front-end to add content)

I've got the database and content moved across and working.. to an extent.
The problem is that all the picture and file links appear to be broken and I'm not sure how to resolve the issue..

The site is set up as follows 
$CFG->wwwroot   = 'http://sitename.com/moodle';
Which is /home/public_html/moodle on my hosted web space..

$CFG->dataroot  = '/home/sitename/data/moodledata';
Which is /home/data/moodledata on my hosted web space..

The data path link is clearly correct and working as I get the bare pages etc..

Trouble is the links are (for example):
http://mysitename.com/moodle/file.php/coursenumber/foldername/filename.jpg

I assumed the file.php substitutes in a part of the path, but that wouldn't appear to work as the data isn't under the moodle directory..
I can't replace it with an explicit URL as I can't browse to the moodledata folder/files, as they are 'above' the public_html directory..
I even tried dropping the moodledata folder to the same folder level as the moodle one (so i could browse to the files), but moodle doesn't appear to like that and kept giving me warning messages under Site Admin etc that I needed to move it out of a public directory..

Which is fair enough but how can I replace the URL's and with what path?
Could I use
/home/sitename/data/moodledata/coursenumber/foldername/filename.jpg somehow?

EDIT- I've tried replacing the url's under the web interface though and it keeps adding http://sitename.com back in before the edited URL when I update/save it

Any help would really be appreciated as I've been dropped into this cold and am unsure how to resolve these issues..

Many Thanks..

 

Average of ratings: -
In reply to Matt Dymond

Re: External hosting and paths

by John Leonard -

I just skimmed through your post.

Have you modified the database changing the URL for each resource from the old one to the new one?

http://yourserver.com/admin/replace.php

Check out http://docs.moodle.org/en/Moodle_migration

In reply to John Leonard

Re: External hosting and paths

by Matt Dymond -

Hi John, I've used the replace function before (and assumed i may well have to use it to fix the issue), but it's what URL to replace it with that's causing me problems..

Moodle complains if the data folder resides within the public_html folder on the host.

But with it now sitting outside that folder, I can't reach it with a URL starting with http://sitename.com like it appears to want (if I try and use a /home path it just sticks that back on the front of it)..

How does it work?

Thanks

In reply to Matt Dymond

Re: External hosting and paths

by John Leonard -

Hopefully we are both talking about a Linux server or similar.

When I install moodle (via yum) it creates a folder called moodle in /var/www/

That is the folder that appears in the URL www.domain/moodle

The yum install (Fedora is my area of experience) sets up apache to serve pages from that moodle folder.

Is the above not happening for you?

In reply to John Leonard

Re: External hosting and paths

by Matt Dymond -

It's not my server John, so I'm not exactly sure what they're running.. it's a paid host service that supports moodle -

It was installed to the space via a provided launcher.. which I presume ran an installer script similar to fantastico etc..
I have access to a site control panel which has some SQL etc tools and there's an Apache handlers module (with a number of system handlers already set up).

There is a home/www folder which mirrors whatever is in the public_html one, so yes there's a home/www/moodle folder in there..

I just don't know how to redirect the URLs to that folder outside public_html..

 

In reply to Matt Dymond

Re: External hosting and paths

by john newsome -

HI Matt,

Hope im reading this right,

In order to redirrect to folders that sit below the public folder you need the root directory path of the folder you want to redirect to and have the script running on the same server that is doing the redirect.

Hope this helps

In reply to john newsome

Re: External hosting and paths

by Matt Dymond -

Hi John,

It's folders at a level above the public/www folder I need to get at..

Webspace root (Home)

|---public.html
|-------moodle

|---www
|-------moodle

|---moodledata

as that's where Moodle strongly advises the moodle data folder to be put, above the publicly accessible folders - else they'll be readable directly via a web url.. but I need to know how to link to them in that location..

From what's been said there should be a script I can config to set to point at \home\moodledata..

How/where do I configure this?

Thanks

Matt

In reply to Matt Dymond

Re: External hosting and paths

by Matt Dymond -

OK, I tried a more radical solution in an attempt to get it working..

I put the data folder into the www directory - checked i could browse to the files  directly - yes, no problem..

So I then ran replace.php.. swapping out:

http://sitename.com/file.php
for
http://sitename.com/data/moodledata

It ran through and listed a ton of changes.. when completed, I went back to the homepage and... nothing.

none of the links have been changed - they're all still pointed at
http://sitename.com/file.php ...

What's going on?

 

In reply to Matt Dymond

Re: External hosting and paths

by john newsome -
In reply to john newsome

Re: External hosting and paths

by Matt Dymond -

Hi John,

I had already set the acceptinfopath on I'm afraid..

It's not made any difference..

Thanks

In reply to Matt Dymond

Re: External hosting and paths

by Nigel Irwin -

You only need to change the http://sitename.com element the rest is taken care of by your config file config.php in

 

$CFG->dataroot  = 'C:\MoodleWindowsInstaller-latest-19\server\moodledata';

 

for example.

In reply to Nigel Irwin

Re: External hosting and paths

by Matt Dymond -

Hi Nigel,

The config.php seems to be pointing to the correct location already.. The site wouldn't work at all otherwise surely?

The sitename on the links isn't really the issue - it's pointing at the right sitename - I'm just unable to get all the links to change from

http://sitename.com/moodle/file.php
to
http://sitename.com/data/moodledata

I can change some links manually in the editor.. but there are thousands..

And running replace.php on them doesn't appear to do anything to them.. the links remain as they were before..