Can repositories support webfiles with relative links?

Can repositories support webfiles with relative links?

by Frankle Lee 李智高 -
Number of replies: 7

Here maybe a stupid question, but it bothers me a lot.

When I was using moodle 1.9x, the file system is simple and easy to understand. If I have a courseware file, I can zip it and upload into moodle, than Moodle can unzip the file and restore the whole folder structure. I can link to a index file and browser the whole courseware.

But it seems to me that moodle 2.x uses repositories and do not support what I mentioned above.

I tried to upload a folder into reposiory, but it seems that the link doesn't work for relative links. That means I can link to the index file with a url resource, but the index may not work because of the other files in the folder does not seem to be in the right relative place.

Average of ratings: -
In reply to Frankle Lee 李智高

Re: Can repositories support webfiles with relative links?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
In reply to Visvanath Ratnaweera

回复: Re: Can repositories support webfiles with relative links?

by Frankle Lee 李智高 -

OMG!It bothers me so many years!!!!

Thank you very much! 

This is really helpful!

In reply to Frankle Lee 李智高

Re: 回复: Re: Can repositories support webfiles with relative links?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Years? Not good! This setting has been there since Moodle 2.3 (June 2012): https://docs.moodle.org/23/en/File_resource_settings#Displaying_a_website_index_page (but not in 2.0 - 2.2).
Average of ratings:Useful (2)
In reply to Visvanath Ratnaweera

回复: Re: 回复: Re: Can repositories support webfiles with relative links?

by Frankle Lee 李智高 -

When I upgraded my site from 1.93 to 2.3, I just miss this part and always using ftp to upload such folders from background sad

In reply to Visvanath Ratnaweera

Re: 回复: Re: Can repositories support webfiles with relative links?

by macoel macoel -

In my case i have done the same that appears in this link but the relative links do not work.

I have upload as a resource file a zip file with the whole website, then i unzip the file inside the moodle file selector, and a folder is created with all contents. Now i have selected the index.htm file and i selected it as main file.

When i click on the resource file the whole site is opened but when click on any link. it does not work.

for example:

if my moodle site is mymoodle.mydomain.es and inside the resource file i click on a link from index.htm file in order to surf to page.htm, the link recognized by moodle is: mymoodle.mydomain.es/page.htm, but this link does not work.

is it possible that when i upload the zip file and unzip it, moodle store the whole site in an unknown area and therefore the relative links do not work properly?

The whole site that i uploaded inside my old 1.9 moodle worked perfectly. if I clicked on any link of my web site, moodle 1.9 recognized the link as myoldmoodle.mydomain.es/file.php/idcoursenumber/openoffice/index.htm

where idcoursenumber is the id number of my moodle course, and folder is the folder in which the whole site is unziped.

In case of 2.6 moodle the link recognized by moodle is:

mymoodle.mydomain.es/pluginfile.php?file=/13818/Fmod_resource/content/3/openoffice/index.htm

but any link nor any css inside the index.htm is correctly recognized. If i check the HTML code of index.htm the href attributes of A elements make reference to the others htm files. They are located in the same folder.


Example: I have one of the web site files called "information.htm" in the same directory as index.htm. if i have the following link inside my index.htm: <a href="information.htm"> more information</a>, it is supposed that the link should be opened correctly but moodle recognize the link as:

mymoodle/mydomain.es/information.htm and it is showed as a broken link. This occurs with all the html files. Apparently, moodle does not recognized the path of hyperlinks. The same occurs with the CSS links so any format is applied to the web site content.

In reply to macoel macoel

Re: 回复: Re: Can repositories support webfiles with relative links?

by Matteo Scaramuccia -

Hi,
you need to configure your instance to use slash arguments i.e. your server should correctly support PATH_INFO.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: 回复: Re: Can repositories support webfiles with relative links?

by macoel macoel -

I know that.

If i enable this option the website is correctly showed but the entire moodle site give up to show correctly. A lot of menu items are inaccesible. My hosting is 1 and 1 and apparently as i could see in several forums, their hosts do not support slash arguments.

So i have a problem, if i enabled slash arguments i achive solve the problem but my moodle lose its format.

on the contrary, if i disable slash arguments the moodle is ok but the relative links do not work, neither images, CSS, etc (SCORM, IMS).