# Append the contents of this file to this .htaccess to the one in your document root or configuration file to enable http # compression and client-side (browser) caching of files that W3 Total Cache does not handle. This file can also be used # for the self-hosted subdomain used in your CDN settings. Remove the optional directives section if necessary. # BEGIN Define Mime Types (in case /etc/mime.types is poorly configured or incorrect) AddType application/x-javascript .js AddType application/x-shockwave-flash .swf AddType image/bmp .bmp AddType image/gif .gif AddType image/jpeg .jpeg AddType image/jpg .jpg AddType image/png .png AddType image/svg+xml .svg AddType image/tif .tif AddType image/tiff .tiff AddType image/x-icon .ico AddType text/css .css AddType text/htm .htm AddType text/html .html AddType text/plain .txt AddType text/xml .xml AddType text/xsd .xsd AddType text/xsl .xsl # END Define Mime Types # BEGIN HTTP Compression # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48 # the above regex won't work. You can use the following # workaround to get the desired effect: BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html # Don't compress media or scripts SetEnvIfNoCase Request_URI (?:bmp|gif|jpe?g|php|png|swf|tiff?)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary # Fragment size to be compressed at one time by zlib #DeflateBufferSize 4096 # Amount of compression applied to output #DeflateCompressionLevel 9 # How much memory should be used by zlib for compression #DeflateMemLevel 9 # Zlib compression window size #DeflateWindowSize 15 # Enable HTTP Compression policy for all except .css, .js and .html documents SetOutputFilter DEFLATE AddOutputFilterByType DEFLATE text/css text/plain text/html text/xml text/xsd text/xsl application/x-javascript \ \. application/wlwmanifest+xml image/svg+xml image/x-icon # END HTTP Compression # BEGIN Headers: Ensure browser caching of objects for 3 days # Set Expires header ExpiresActive On ExpiresByType application/x-javascript A259200 ExpiresByType application/x-shockwave-flash A259200 ExpiresByType application/wlwmanifest+xml A259200 ExpiresByType image/bmp A259200 ExpiresByType image/gif A259200 ExpiresByType image/jpeg A259200 ExpiresByType image/jpg A259200 ExpiresByType image/png A259200 ExpiresByType image/svg+xml A259200 ExpiresByType image/tif A259200 ExpiresByType image/tiff A259200 ExpiresByType image/x-icon A259200 ExpiresByType text/css A259200 ExpiresByType text/htm A259200 ExpiresByType text/html A259200 ExpiresByType text/plain A259200 ExpiresByType text/xml A259200 ExpiresByType text/xsd A259200 ExpiresByType text/xsl A259200 # Set Pragma header Header set Pragma "public" # Set Cache-Control header Header set Cache-Control "max-age=259200, public" # For optimal performance remove cookies #Header unset Set-Cookie # Set Entity Tag header FileETag MTime Size # END Headers: Ensure client-side caching of objects # BEGIN Optional Directives (if using a non-default permalink setting) RewriteEngine On RewriteBase / # BEGIN Do not allow WordPress to process static objects RewriteCond %{REQUEST_FILENAME} !^.*\.bmp [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.css [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.gif [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.html? [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.js [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.jpe?g [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.png [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.svgz? [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.swf [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.tiff? [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.txt [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.xsd [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.xsl [NC] RewriteCond %{REQUEST_FILENAME} !^.*\.xml [NC] # END Do not allow WordPress to process static objects # Default WordPress Directives RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END Optional Directives