Importing a website

Importing a website

by Craig Douglas -
Number of replies: 26
Is there anyway of importing simple html websites into moodle? It doesn't really need to be integrated into moodle, but being able to host websites would be good.

The way I've tried so far is to upload the website files into the course files (all the html links are relative links, not absolute) and then create a resource link to file or web site to the index.html.

This brings up the page but any links are broken because rather than the relative link being interpreted as relative to where the file is (ie in the course files) it does it relative to the whole site so it goes to http://moodle.mycollege.ac.uk/page1.html.

I've done the links as (examples):

<a href="page1.html"></a>

and

<a href="./page1.html"></a>

to no avail.

Any ideas?
Average of ratings: -
In reply to Craig Douglas

Re: Importing a website

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
Put the whole website into its own folder with links relative to that folder and then upload it and link to the index.html file within it. It should work then.
In reply to Mary Cooch

Re: Importing a website

by Craig Douglas -
That is what I've done, as described above.

For example I have folder structure:

ScenarioWebSite
ScenarioWebSite/index.html
ScenarioWebSite/HTML
ScenarioWebSite/HTML/Assignment.html

(there are more, but this is an example)

index.html contains a link written as:

<a href="HTML/Assignment.html">Assignment</a>

This works fine locally on the hard drive.

I then uploaded into the course files.

Then I linked to index.html using the "Link to a file or website" under resources.

When I click the link, the url path is: http://moodle.leggott.ac.uk/file.php?file=%2F549%2FScenarioWebSite%2Findex.html

index.html does load up and has the link but the link points to http://moodle.leggott.ac.uk/HTML/Assignment.html



I'm using one of the latest builds of moodle so possibly i'm experiencing a bug?

Moodle 1.9.4+ (Build: 20090506)
In reply to Craig Douglas

Re: Importing a website

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You need to zip up your whole website (folders an' all) and upload them to your course files area. Once you have uploaded the zip file, unzip it in your course files; then link to the index.html file. If all your links are relative, this should work.
In reply to Jon Witts

Re: Importing a website

by Craig Douglas -
This is what I've been doing.

For proof, here is a word document with screen shots going through every step. Please tell me what I'm doing wrong!

http://www.dougspace.co.uk/jlc/StepByStep.doc

I've done it like this so you can zoom right in to see specific areas.
In reply to Craig Douglas

Re: Importing a website

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
OK, those steps should work... Strange that they are not.

What has caught my eye is this line you posted: "When I click the link, the url path is: http://moodle.leggott.ac.uk/file.php?file=%2F549%2FScenarioWebSite%2Findex.html"

It appears as if your server is URL Encoding the links within file.php...

I'm afraid I can not help you much more than that; but maybe someone else out there has seen this before...

Have you tried changing the slash arguments settings? (Admin > Server > HTTP)
In reply to Jon Witts

Re: Importing a website

by christian theou -
Hello,

Perhaps it is wrong but for me , if you use Firefox it's necessary to use absolute link (after the upload in Moodle) in all links of your web site . I have already seen this before.
I remember that with IE relative link works.
Why ?????!!!!
In reply to christian theou

Re: Importing a website

by Craig Douglas -
I tried exactly the same process with IE but it still doesn't work.
In reply to Jon Witts

Re: Importing a website

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
If you log in to your Moodle then enter the link: http://moodle.leggott.ac.uk/file.php?file=/549/ScenarioWebSite/index.html
does it work as expected?
In reply to Jon Witts

Re: Importing a website

by Craig Douglas -
No it doesn't, that was one of the first things I tried but it doesn't work.

I'll attempt the same process in IE but I can't understand why a different browser would make a difference.
In reply to Jon Witts

Re: Importing a website

by Craig Douglas -
When I turn slash arguments on, lots of things break and the site displays:

No input file specified.

instead.
In reply to Craig Douglas

Re: Importing a website

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Umm OK. It was worth a try wink

What version of Moodle are you running and what are your server specs?

There is someone else who is experiencing similar things to you and I would like to know if there are any other common grounds. It may be a bug in the particular version you are running, but we need to narrow it down a bit more before we report it...

I have not been able to reproduce this in my live site (version 1.9.3 on LAMP), but will try on my testing one at home tonight (version 1.9.5 on LAMP).

In reply to Jon Witts

Re: Importing a website

by Craig Douglas -
Version is still as stated in original post: Moodle 1.9.4+ (Build: 20090506)

Server: IIS6 using ISAPI
PHP: 5.2.6
MySQL: 5.0.51a

Any other info required?
In reply to Craig Douglas

Re: Importing a website

by christian theou -
You say that it doesn't work when you enter the link: http://moodle.leggott.ac.uk/file.php?file=/549/ScenarioWebSite/index.html,
but, what you obtain exactly : an error message ? the same page that in Moodle with the bad links ? .......
In reply to christian theou

Re: Importing a website

by Craig Douglas -
Sorry, the same as before. I get the page but no css and with bad links. Just the same as when it displays with %2F instead of the /'s
In reply to Craig Douglas

Re: Importing a website

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
OK,

I have uploaded the attached zip file to my 1.9.5 site at home as a test and can confirm that it works absolutely fine with Slash Arguments "On" but displays the errors you have described when turning slash arguments off.

I will upload the same file to my 1.9.3 live site at school tomorrow and try the same checks.

If other people could try the file too, maybe we can narrow down why this is happening when slash arguments is set to off.

Jon
In reply to Jon Witts

Re: Importing a website

by christian theou -
Hello,

On a 1.9.2 (Build 20080716) i have no problem with the test when slash argument is ON but when is OFF , i have the same result that you: bad links.

On a 1.9.5 (Build 20090527) , same thing
In reply to christian theou

Re: Importing a website

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi,

It is the same on our 1.9.3 install too.

The links work as expected with slash arguements ON; turn slash arguments OFF and all relative links point <WWW ROOT>/<LINK> instead of <WWW ROOT>/file.php/<COURSE>/<LINK>

I will post this in the bug tracker...


In reply to Jon Witts

Re: Importing a website

by Craig Douglas -
Thanks for your efforts Jon!

Lots of things break on our server when slash arguments is on so I can't test that, but when it is off that site still doesn't work in the same way as my other site. (I know that's probably an obvious outcome from me given the rest of the thread but thought I'd make the direct comparison).

Moodle 1.9.4+ (Build: 20090506)
In reply to Craig Douglas

Re: Importing a website

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
OK,

I have reported this in the tracker MDL-19334. Vote for it if you would like to see it resolved. smile

Jon
In reply to Jon Witts

Re: Importing a website

by Craig Douglas -
I can't see how to vote. Do I need to register with the tracker too?
In reply to Craig Douglas

Re: Importing a website

by Craig Douglas -
Never mind, I registered only to find it's now classed as not a bug, maybe it's a "feature" mixed

We can't turn slash arguments on without lots of things breaking so that means we can't use relative links at all??
In reply to Craig Douglas

Re: Importing a website

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
To quote Petr: "slasharguments are mandatory if you want your relative links to work. There is no way to make it work without it, sorry"

So to get relative links to work in your upload HTML files you must resolve the other issues you are seeing when slasharguments is turned on...

What are the issues you are seeing with slasharguments on?
In reply to Jon Witts

Re: Importing a website

by Craig Douglas -
Lots. It simply doesn't work with IIS, have a quick search of the forums for slash arguments and you'll lots of frustrated people. I'm looking at some of the workarounds now in those threads.
In reply to Craig Douglas

Re: Importing a website

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Have a look at this M$ article http://msdn.microsoft.com/en-us/library/ms972974.aspx
and the Moodle docs page for info on configuring ISS for URL rewriting http://docs.moodle.org/en/Installation_FAQ#Uploaded_files_give_.22File_not_found.22

Is an Apache server not an option for you?

Good luck! wink
In reply to Jon Witts

Re: Importing a website

by Craig Douglas -
Apache is a last resort. Every other server is IIS so maintenance is more straight forward. Also we've finally got most things working smoothly eg LDAP NTLM SSO etc so migrating to a new server that we've got little expertise on is not too desireable. On the other hand this is stopping us from doing stuff in moodle so it may be necessary.

I've followed them and tried two different rewrite filter programs with the recommended expression but it's not working. No uploaded files work at all with slash arguments on, including course files and user pictures. I just get file not found error.

I feel like I'm going round in circles at the minute!