path: root/docs
diff options
authorGravatar Angelo Compagnucci <angelo.compagnucci@gmail.com>2017-02-22 23:52:36 +0100
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-03-01 22:17:31 +0100
commitbfad6ea9b1f58f2ff98643dd1d4a7f2fb97c7049 (patch)
tree7ecec357e368f693d26d8144e8f7d95dd14ef08e /docs
parentbbe2d66110e896e24913368ffa9e01a75cc53fa1 (diff)
docs/website: improve website speed
Currently the buildroot website is not leveraging common techniques to have a better loading speed (browser caching, gzip compression, deflating). This commit provides an .htaccess files with all the needed to enable mentioned features. This .htaccess only works if the webserver has deflate, expires and headers modules enabled. Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'docs')
1 files changed, 62 insertions, 0 deletions
diff --git a/docs/website/.htaccess b/docs/website/.htaccess
new file mode 100644
index 0000000000..b02beb8854
--- /dev/null
+++ b/docs/website/.htaccess
@@ -0,0 +1,62 @@
+# BEGIN Compress text files
+<ifModule mod_deflate.c>
+ <filesMatch ".(css|js|x?html?|php)$">
+ SetOutputFilter DEFLATE
+ </filesMatch>
+# END Compress text files
+# BEGIN Expire headers
+<ifModule mod_expires.c>
+ ExpiresActive On
+ ExpiresDefault "access plus 1 seconds"
+ ExpiresByType image/x-icon "access plus 2592000 seconds"
+ ExpiresByType image/jpeg "access plus 2592000 seconds"
+ ExpiresByType image/png "access plus 2592000 seconds"
+ ExpiresByType image/gif "access plus 2592000 seconds"
+ ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
+ ExpiresByType text/css "access plus 604800 seconds"
+ ExpiresByType text/javascript "access plus 216000 seconds"
+ ExpiresByType application/javascript "access plus 216000 seconds"
+ ExpiresByType application/x-javascript "access plus 216000 seconds"
+ ExpiresByType text/html "access plus 600 seconds"
+ ExpiresByType application/xhtml+xml "access plus 600 seconds"
+# END Expire headers
+# BEGIN Cache-Control Headers
+<ifModule mod_headers.c>
+ <filesMatch ".(ico|jpe?g|png|gif|swf)$">
+ Header set Cache-Control "max-age=2592000, public"
+ </filesMatch>
+ <filesMatch ".(css)$">
+ Header set Cache-Control "max-age=604800, public"
+ </filesMatch>
+ <filesMatch ".(js)$">
+ Header set Cache-Control "max-age=216000, private"
+ </filesMatch>
+ <filesMatch ".(x?html?|php)$">
+ Header set Cache-Control "max-age=600, private, must-revalidate"
+ </filesMatch>
+# END Cache-Control Headers
+# BEGIN Turn ETags Off
+<ifModule mod_headers.c>
+ Header unset ETag
+FileETag None
+# END Turn ETags Off
+# BEGIN gzip
+<ifModule mod_gzip.c>
+mod_gzip_on Yes
+mod_gzip_dechunk Yes
+mod_gzip_item_include file .(html?|txt|css|js)$
+mod_gzip_item_include handler ^cgi-script$
+mod_gzip_item_include mime ^text/.*
+mod_gzip_item_include mime ^application/x-javascript.*
+mod_gzip_item_exclude mime ^image/.*
+mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
+# END gzip