Broken links

Broken links

by Gunilla Brattberg -
Number of replies: 15

I have upgraded Moodle from 2.2.9 to 2.5.2. To get the links work I have also run the "Search and replace tool" to change the root folder. But the images andra pdf-files still do not appear.

Average of ratings: -
In reply to Gunilla Brattberg

Re: Broken links

by Guillermo Madero -

Hi Gunilla,

So you did an upgrade and a migration?

In reply to Guillermo Madero

Svar: Re: Broken links

by Gunilla Brattberg -

Yes, I did upgrade and the installation is now in another folder with another name and therefore I run the "Search and Replace tool" to get the paths correct. But the links to pdf and images are still broken.

/Gunilla

In reply to Gunilla Brattberg

Re: Svar: Re: Broken links

by Guillermo Madero -

Hi Gunilla,

Have you seen how do the links look like? Maybe it could help determine why are they broken. Was the 2.2.9 version a clean install or an upgrade? If so, from which version, or how many upgrades has the site have gone through. I ask because upgrades from 1.9 left files in what's known as legacy files.

Are all images and all PDF files broken, or only those in a particular course?

I would start by checking the web server logs and enabling the Moodle debugging, apart from checking the URL of the broken resources.

Could it be a firewall issue? A proxy? Can you think if there were any other changes made to the environment, either to the web server, PHP, etc?

In reply to Guillermo Madero

Svar: Re: Svar: Re: Broken links

by Gunilla Brattberg -

Hi Guillermo,

My 2.2.9 version was a result of upgrading from 1.6 to 1.9.19 and then to 2.2.9. I did it last spring and it was the same problem with all links broken to images and podf-files. At that time I imported all these pdf:s and images manually. The 2.2.9. version from which I started now when upgrading to 2.5.2 was thus working fine regarding to these links. 

You can see how the links look in the attached image. In the path you find webbklinik_ny which is the folder for all the moodle-files.

All links are broken in the front page and in all courses.

How do I check the web server logs and enabling the Moodle debugging?

In version 2.5.2 I use InnoDB which I didn´t in version 2.2.9, but the links were broken before I changed to InnoDB. It is a higer version of mysql in 2.5.2 than it was in 2.2.9 but I don´t think thats the problem as all the links also were broken in 2.2.9 before I linked images and pdf:s manually.

/Gunilla

Attachment broken_links.PNG
In reply to Gunilla Brattberg

Re: Svar: Re: Svar: Re: Broken links

by Guillermo Madero -

Hello Gunilla,

From what I saw, the problem is not in Moodle but in your server configuration.

It is difficult to tell how is your directory structure organized, but I tried to browse to the gunilla_mars13.jpg image file, shown it the image you posted, and while the address bar kept the full URL:

http://www.varkstaden.se/webbkklinik_ny/pluginfile.php/2/course/section/1/gunilla_mars13.jpg

what I got was not a jpg file but the referring web page:

http://www.varkstaden.se/webbkklinik_ny/

I would have thought that that page is the Moodle page (given the following pluginfile.php reference in the URL) but it sure doesn't look like the usual Moodle front page, or the one shown in the image you posted.

That page has, or references, a "Värkstadens logotyp" logo file:

http://www.varkstaden.se/webbkklinik_ny/bilder/logotyp.jpg

But then again, trying to display that image just displays the same page.

As a matter of fact, regardless of what link is selected from that page, it (the page displayed) never changes: every link and resource (css, js, jpg etc) is being redirected to that page.

Maybe there's a .htaccess (dot htaccess) file (assuming you have an Apache web server) that has a wrong redirection definition, but given the lack of information it would be difficult to tell. Whether it is an Apache or an IIS web server, there is something wrong with its setting.

So... you definitely need to talk to whoever is in charge of your server and ask to have it fixed. Then, and only then, will it be possible to see if your Moodle installation actually has some issues or not.

In reply to Guillermo Madero

Svar: Re: Svar: Re: Svar: Re: Broken links

by Gunilla Brattberg -

Thank you for this answer. I will ask my webhotel support.

/Gunilla

In reply to Guillermo Madero

Svar: Re: Svar: Re: Svar: Re: Broken links

by Gunilla Brattberg -

Hi again, I did send your proposal to the web hotel support and got the following answer:

" I've looked in / home / v / varkstad / www / webbklinik_ny but there is none .htaccess so it does not seem to be the problem."

This is above my competence level so may be there is no other way than to import all images and pdf-files again. I am sure there must be some easier way to link these files, but how???? This problem didn´t occur when I upgraded older versions (<2.0) .

/Gunilla

In reply to Gunilla Brattberg

Re: Svar: Re: Svar: Re: Svar: Re: Broken links

by Guillermo Madero -

Oh goodness! That kind of answers from web hosting providers are so common, unfortunately. My experience is that one has to insist until the support area actually moves and fixes whatever the issue(s) might be.

I just mentioned that the problem could reside in a .htaccess file, not that there was one or that it was actually causing the problem. While most probably you'll have an Apache web server, I cannot affirm that. If you are working with an IIS web server, then there's no way that there would be a .htaccess file.

Problems might seem to reside where they aren't just because we are unaware of other factors (hm, sounds like a life lesson). So what other changes occurred at that time or near that time, when you upgraded? Hosting providers make changes and we aren't told about them, we only experience "sudden" issues.

If you try to open a simple image (webbkklinik_ny/bilder/logotyp.jpg) that resides outside of Moodle (as you didn't confirm nor denied my assumption, I'll keep assuming that the http://www.varkstaden.se/webbkklinik_ny/ address is not the Moodle address), and you get a web page instead, it is then evident, or it should be evident, that this is not a Moodle problem; this is a server configuration issue and you need to put pressure on your hoster. But of course, you could try and reload all the resources, who knows, I might not be seeing something that I cannot see from where I stand.

Good luck.

In reply to Guillermo Madero

Svar: Re: Svar: Re: Svar: Re: Svar: Re: Broken links

by Gunilla Brattberg -

Voila!

All the links are now okay. I changed the dataroot directive in config.php to the directive which belongs to the 2.2.9 installation and then the images and pdf:s appeared. I didn´t realize that these moodledata files are necessary for the site to work. I thought images and pdf:s were placed in the database and that moodledata only was a backup in case of corrupt database, or when I have to restore and course backup.

Another problem is the automatic backup. I have got a mail from the “system” that all courses were backupped at 8.00, but in Site administration>Reports>Backups the Status for all courses are “Skipped”.

"VÄRKSTADENS kurser i "Livets Universitet" 12 okt, 08:00 - 12 okt, 08:00 Skipped 18 okt, 08:00"

However, when I try to restore a course there is a backup att 8.00 to restore. How can this be? I have unchecked “Skip hidden courses”, “Skip courses not modified” and “Skip courses not modified since previous backup”, but the backup status is still “skipped”. The reason why the logo has another path is that the logo was added during the installation process and then I wrote webbklinik and not webbklinik_ny.

Lastly, I will check with you what to do when it´s time to migrate from webbklinik_ny to webbklinik. I think I have to:

• Change the name of the rootmap to webbklinik

• Run the Search and replace tool to change the paths in the database

• In config.php change $CEF->wwwroot to ‘http://sss.varkstaden.se/webbklinik

Is it correctly understood?

Thank you so much for all valuable comments.

/Gunilla

In reply to Gunilla Brattberg

Re: Broken links

by Guillermo Madero -

Hi Gunilla,

Good. But each Moodle installation should have its own moodledata directory:

Moodle site = Moodle code + moodledatafolder + Moodle database

About the backup issue, it would be best if you open a new thread for that subject.

Cheers!

In reply to Guillermo Madero

Svar: Re: Broken links

by Gunilla Brattberg -

There is something I don´t understand.

I started the installation with a new empty moodledata folder an then all the links were broken. When I then copied all the files in the old moodledata folder and pasted them in the new moodledata folder all the links were okay.

As I can remember this procedure isn´t mentioned in the upgrade manual. Is there any other way to do it?

/Gunilla

In reply to Gunilla Brattberg

Re: Svar: Re: Broken links

by Guillermo Madero -

Hello Gunilla,

Ah, well, one starts with an empty moodledata directory when one does a new, fresh Moodle installation. During this process, several new directories and new files will be created under it, and once the site starts to be used, that folder will contain both, the files that conform the content of the course (pdf files, images, etc.) and files of the users (picture profile, assignments, private files, etc.).

Physical files then, reside in the moodledata directory. And this is why when one does an upgrade or a migration, one always uses the original moodledata directory (of course, before doing the upgrade or the migration, one always backs up this moodledata directory, as well as the moodle directory and the moodle database).

One sometimes may want to replicate a Moodle site (e.g. to test an upgrade), and so one copies the moodle installation directory, the moodledata directory and the moodle database.

http://docs.moodle.org/25/en/Moodle_migration

Just as a reference, references to files in moodledata are stored in the database, but that is another story.

I would amply recommend you to get familiar with the Moodle documentation:

http://docs.moodle.org/25/en/Main_page

http://docs.moodle.org/25/en/Table_of_Contents

Average of ratings: Useful (1)
In reply to Guillermo Madero

Svar: Re: Svar: Re: Broken links

by Gunilla Brattberg -

Thank you for this clarification.

I am now ready to use my 2.5.2 installation!

/Gunilla

In reply to Guillermo Madero

Svar: Re: Svar: Re: Svar: Re: Broken links

by Gunilla Brattberg -

I got another idea to get the links work.

If I use the same moodledata folder (Course backup filearea) in this 2.5.2 installation as I do in my 2.2.9 installation, is it then possible to restore the courses and get all the images and pdf:s linked?

I have several moodledata folders and can´t remember which one is used in this new installation. Where can I see that? Is it possible to change folder?

/Gunilla

In reply to Gunilla Brattberg

Re: Svar: Re: Svar: Re: Svar: Re: Broken links

by Guillermo Madero -

Hi Gunilla,

If you open your Moodle config.php configuration file, located under your Moodle installation folder, there you'll find the $CFG->dataroot directive; its value points to the moodledata folder location.

Yes, you can create a new folder, move the contents from the original one into the new one, and update the value of the $CFG->dataroot directive in file config.php.