From eba0f09d1e3ace7576248cdb21f0c88bb9a7b58e Mon Sep 17 00:00:00 2001 From: skilledDeveloper Date: Mon, 23 Feb 2015 13:27:16 -0800 Subject: [PATCH] added three more snippets in performance section --- README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d11d6ba..90a0472 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,9 @@ What we are doing here is mostly collecting useful snippets from all over the in - [Compress Text Files](#compress-text-files) - [Set Expires Headers](#set-expires-headers) - [Turn eTags Off](#turn-etags-off) + - [Enable gzip Compression for All Files Except for Images](#enable-gzip-compression) + - [Disable gzip Compression](#disable-gzip-compression) + - [1 Day Caching](#one-day-caching) - [Miscellaneous](#miscellaneous) - [Set PHP Variables](#set-php-variables) - [Custom Error Pages](#custom-error-pages) @@ -390,6 +393,24 @@ By removing the ETag header, you disable caches and browsers from being able to FileETag None ``` +### Enable gzip Compression for All Files Except for Images +This enables gzip compression for all files in the folder except for the images. Images are already compressed and re-compressing them is just waste of resources. +``` apacheconf +SetOutputFilter DEFLATE +SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|bmp|tiff)$ no-gzip dont-vary +``` + +### Disable gzip Compression +This disables gzip compression for the folder. +``` apacheconf +SetEnv no-gzip +``` + +### 1 Day Caching +Allows the contents of the folder to be cached for one day. This can be adjusted to any different number of seconds. +``` apacheconf +Header set Cache-Control "max-age=86400, public" +``` ## Miscellaneous @@ -478,4 +499,4 @@ RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{DOCUMENT_ROOT}/$1.webp -f RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1] ``` -[Source](https://github.com/vincentorback/WebP-images-with-htaccess) \ No newline at end of file +[Source](https://github.com/vincentorback/WebP-images-with-htaccess)