# Change this file to fit your configuration and save it as .htaccess in the courses folder #
# Dokeos mod rewrite
# Comment lines start with # and are not processed
<IfModule mod_rewrite.c>
RewriteEngine On
# Rewrite base is the dir dokeos is installed in with trailing slash
RewriteBase /courses/
# Do not rewrite on the main dir
# Change this path to the path of your main folder
RewriteCond %{REQUEST_URI} !^/main/
#replace nasty ampersands by 3 slashes, we change these back in download.php
RewriteRule ([^/]+)/document/(.*)&(.*)$ $1/document/$2///$3 [N]
# Rewrite everything in the scorm folder of a course to the download script
RewriteRule ([^/]+)/scorm/(.*)$ /main/document/download_scorm.php?doc_url=/$2&cDir=$1 [QSA,L]
# rewrite will not work in ipad
RewriteCond %{REQUEST_URI} !.(mp3|ogg|oga|mp4|h264|m4v|f4v|mov)$ [NC]
# Rewrite everything in the document folder of a course to the download script
RewriteRule ([^/]+)/document/(.*)$ /main/document/download.php?doc_url=/$2&cDir=$1 [QSA,L]
# Rewrite everything in the streaming folder of a course to the download script
RewriteRule (^|streaming)/(.*)$ /main/document/download_video_not_allowed.php?doc_url=/$2&cDir=$1 [QSA,L]
# Rewrite everything in the work folder
RewriteRule ([^/]+)/work/(.*)$ /main/work/download.php?file=work/$2&cDir=$1 [QSA,L]
</IfModule>