Calling all Regular Expression experts!
Apologies for this rather lengthy post, but if you can solve the following issue with some elegant regular expression code, you just might make a lot of current and future Moodle/IIS/SCORM users very happy. Read on if you dare...
First I'll lay out the background to this issue (apologies to those that already know it), then I'll explain what I think we need to provide as a solution to finally get SCORM packages working reliably on IIS.
HISTORY: For years now, we have been seeing numerous posts in the SCORM forum (and other forums) from baffled Moodle users trying to get this wonderful LMS to work seamlessly with the IIS web server. The complaints usually center around page not found (404) errors on combinations of files uploaded to Moodle that work perfectly anywhere else. Often those offering assistance comment that they have no issues playing the same content on their Moodle site running Apache server.
The issue is due to the way that some pages in Moodle pass information about the URL address of another page by tacking this information on the end of a URL. (E.g. mypage.php?nextpage=/folder1/subfolder1/otherpage.php) Though a common enough technique in web development, this can prove problematic, especially for IIS. SCORM packages seem to be most affected by this issue because they often involve a complex cascade of pages calling other pages, passing arguments in links to play the content and communicate with the SCORM API on the LMS, etc, etc. Their complexity is their downfall in this case.
On Apache server, the issue often goes away as soon as you play with the Admin > Server > HTTP > Use Slash Arguments setting. But IIS 6 is unable to use slash arguments because Microsoft disabled this 'feature' as it was a well-known security hole exploited by hackers. (IIS 7 is rumoured to have options that allow it to operate safely again.)
About ISAPI Rewrite: The workaround successfully used by some Moodle-IIS users in various forum posts to fix IIS has been to install a small application called ISAPI Rewrite that intercepts the call to URLs on IIS and dynamically rewrites them into a more palatable format. This app is well known to webserver admins and used to implement redirects and/or improve search engine friendliness of websites. Once ISAPI Rewrite is installed on your webserver, you just create a new Web Service Extension in IIS Manager, point it to the ISAPI_Rewrite.dll, make a copy of the httpd.ini file from the C:\Program Files\Helicon\ISAPI_Rewrite and copy it into your Moodle root directory (so that any code there only affects Moodle), and finally add a rewrite rule. The rewrite rule quoted in many Moodle forum posts as pulling off the fix is a line of code (a regular expression) that looks like this:
RewriteRule (.*?\.php)(\/.+) $1\?file=$2 [N,I]
However, it doesn't seem to work for most SCORM packages, and I believe the reason is that SCORMs involve much more complex interactions and argument passing between pages that this little rewrite rule doesn't allow for. Under SCORM, the rewrite rule can encounter not just one set of arguments but several.
I'm currently using Moodle 1.82 on IIS 6.0 and ISAPI Rewrite with the rule shown above. I can get any type of content to play,...except SCORM. Perusing IIS server logs I've found that the URL which is failing on my box looks like this:
Notice that there are not one but two question marks in this URL? I think this is why IIS is falling over and if we could tweak the rewrite rule to allow for this, we might just be able to get SCORMs (at least those created by Captivate) to play on IIS. We may even need multiple rules customised to a given SCORM implementation to get them working.
Now since I don't know how to write regular expressions...is there anyone out there that can oblige?? If so, and we can put this issue to bed, we may have eliminated a major source of frustration for many Moodle users.