Report this

What is the reason for this report?

How do setup gzip & leverage browser caching properly on Wordpress

Posted on May 2, 2014

Hi, a newbie question, Wordpress on Ubuntu 13.10 one click install.

thanks in advance



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

The simplest solution is probably to use the W3 Total Cache plugin: <br> <br>https://wordpress.org/plugins/w3-total-cache/ <br> <br>In the admin panel, go to Plugins -> Add New and search for “w3 cache” and click the install link. Now go to Plugins -> Installed Plugins and click the “activate” link. You should now see a new “Performance” menu in the sidebar of the admin panel. gzip compression should now be enabled. To verify that, go to Performance --> Browser Cache and make sure “Enable HTTP (gzip) compression” is checked. It should look like: <br> <br>http://i.imgur.com/Ramgb1Y.png <br> <br>

Thanks Andrew! I’ll try…

Hi again, w3 is so complex for me, it requires too much thing on server side and i am far from there… i just searched and i found .htaccess modification. <br> <br>my .htaccess file like this, but browser caching doesn’t work. <br>any advice? <br>thanks a lot <br>tolga <br>----------------------------------------------------------------------------------- <br># BEGIN WordPress <br><ifmodule mod_rewrite.c=“”> <br>RewriteEngine On <br>RewriteBase / <br>RewriteRule ^index.php$ - [L] <br>RewriteCond %{REQUEST_FILENAME} !-f <br>RewriteCond %{REQUEST_FILENAME} !-d <br>RewriteRule . /index.php [L] <br></ifmodule> <br> <br>##EXPIRES CACHING## <br><ifmodule mod_expires.c=“”> <br># Enable expirations <br>ExpiresActive On <br># Default directive <br>ExpiresDefault “access plus 1 month” <br># My favicon <br>ExpiresByType image/x-icon “access plus 1 year” <br># Images <br>ExpiresByType image/gif “access plus 1 month” <br>ExpiresByType image/png “access plus 1 month” <br>ExpiresByType image/jpg “access plus 1 month” <br>ExpiresByType image/jpeg “access plus 1 month” <br># CSS <br>ExpiresByType text/css “access 1 month” <br># Javascript <br>ExpiresByType application/javascript “access 1 month” <br></ifmodule> <br> <br><ifmodule mod_mime.c=“”> <br>AddType application/x-javascript .js <br>AddType text/css .css <br></ifmodule> <br> <br><ifmodule mod_deflate.c=“”> <br>SetOutputFilter DEFLATE <br><ifmodule mod_setenvif.c=“”> <br>SetEnvIfNoCase Request_URI .(?:rar|zip)$ no-gzip dont-vary <br>SetEnvIfNoCase Request_URI .(?:gif|jpg|png)$ no-gzip dont-vary <br>SetEnvIfNoCase Request_URI .(?:avi|mov|mp4)$ no-gzip dont-vary <br>SetEnvIfNoCase Request_URI .mp3$ no-gzip dont-vary <br></ifmodule> <br><ifmodule mod_headers.c=“”> <br>Header append Vary User-Agent env=!dont-vary <br></ifmodule> <br></ifmodule> <br> <br># END WordPress

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.