From da21a80205b6490453788370169b48f3f68e5125 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 14 Jun 2019 06:08:48 -0500 Subject: [PATCH] Add documentation on rules to optimize loading of media resources from documents --- documentation/optimization.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/documentation/optimization.html b/documentation/optimization.html index b3ba2487d6..f3b6ba9373 100755 --- a/documentation/optimization.html +++ b/documentation/optimization.html @@ -408,7 +408,7 @@ If you want to speed up files accesses and you don't really care about whom can download.php and let Apache treat the file directly.

Furthermore, using a PHP script for the download (unless you have special rules) will usually prevent static content caching, which will multiply downloads - and use large amount of additional bandwidth.

+ and use large amounts of additional bandwidth.

Typically, the .htaccess will look like this (with additional comments):
 
@@ -458,6 +458,16 @@ add theses line after RewriteBase /courses/:
 RewriteRule (\.(html|gif|jpg|jpeg|png|js|pdf|ico|icon|css|swf|avi|mp3|ogg|wav|ttf|otf|eot|woff))$ - [L]
 

+

+Since version 1.11.10, the .htaccess has been modified to do this by default with media files, and a change post-1.11.10 also does it for documents that are not in a SCORM folder. These changes will improve speed considerably but will lower the security on media files, as a direct link could be used to open the file with no validation. As such, you can comment those lines with media files to ensure increased security, at the cost of performance. These are the two lines (followed by their more wide-ranging rule) that have to be present in .htaccess for maximum efficiency. +

+RewriteRule ^courses/([^/]+)/scorm/(.*([\.js|\.css|\.png|\.jpg|\.jpeg|\.gif]))$ app/courses/$1/scorm/$2 [QSA,L]
+RewriteRule ^courses/([^/]+)/scorm/(.*)$ main/document/download_scorm.php?doc_url=/$2&cDir=$1 [QSA,L]
+[...]
+RewriteRule ^courses/([^/]+)/document/(.*([\.js|\.css|\.png|\.jpg|\.jpeg|\.gif|\.mp4|\.webm|\.avi|\.mpeg|\.mp3|\.wav|\.ogg]))$ app/courses/$1/document/$2 [QSA,L]
+RewriteRule ^courses/([^/]+)/document/(.*)$ main/document/download.php?doc_url=/$2&cDir=$1 [QSA,L]
+
+


MySQL/MariaDB compression