Add documentation on rules to optimize loading of media resources from documents

pull/2926/head
Yannick Warnier 6 years ago
parent d11a7033d6
commit da21a80205
  1. 12
      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.<br /><br />
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.<br /><br />
and use large amounts of additional bandwidth.<br /><br />
Typically, the .htaccess will look like this (with additional comments):<br />
<pre>
<IfModule mod_rewrite.c>
@ -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]
</pre>
</p>
<p>
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.
<pre>
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]
</pre>
</p>
<hr />
<h2><a name="12.MySQL-compression"></a>MySQL/MariaDB compression</h2>
<p>

Loading…
Cancel
Save