Compress All content/Caching/mod_DEFLATE fast my Blog...

Posted May 7, 2015 3.1k views

Can anyone help (Compress All content/Caching) from my blog so that it becomes lighter? see this: in my old hosting had an option to optimize blog and though I requested the Digital Ocean, they sent me a code below and asked to copy and paste, but not works (.htaccess but not worked). If anyone can help. Thank you.

This code below nnot Woks…


ExpiresActive On
ExpiresByType image/jpg “access plus 1 year”
ExpiresByType image/jpeg “access plus 1 year”
ExpiresByType image/gif “access plus 1 year”
ExpiresByType image/png “access plus 1 year”
ExpiresByType text/css “access plus 1 month”
ExpiresByType application/pdf “access plus 1 month”
ExpiresByType text/x-javascript “access plus 1 month”
ExpiresByType application/x-shockwave-flash “access plus 1 month”
ExpiresByType image/x-icon “access plus 1 year”
ExpiresByType application/javascript “access plus 1 month”
ExpiresDefault “access plus 2 days”


compress text, HTML, JavaScript, CSS, and XML

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

remove browser bugs

BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Enable your .htaccess file by setting AllowOverride to All in your vhost.

@Woet thanks. I do not know which path, can detail please? See my log…

[Wed May 06 00:23:25.223053 2015] [core:alert] [pid 5223] [client] /var/www/.htaccess: Invalid command ‘ExpiresActive’, perhaps misspelled or define$
[Wed May 06 00:23:25.952712 2015] [core:alert] [pid 5222] [client] /var/www/.htaccess: Invalid command 'ExpiresActive’, perhaps misspelled or define$
[Wed May 06 00:23:44.875065 2015] [core:alert] [pid 5224] [client] /var/www/.htaccess: Invalid command 'ExpiresActive’, perhaps misspelled or define$
[Wed May 06 00:23:45.875695 2015] [core:alert] [pid 5226] [client] /var/www/.htaccess: Invalid command 'ExpiresActive’, perhaps misspelled or define$
[Wed May 06 00:25:21.909598 2015] [core:alert] [pid 5225] [client] /var/www/.htaccess: Invalid command 'ExpiresActive’, perhaps misspelled or defin$
[Wed May 06 00:31:15.727432 2015] [core:alert] [pid 5222] [client] /var/www/.htaccess: Invalid command 'ExpiresActive’, perhaps misspelled or defin$