
Because speed is so important for SEO, it shouldn’t come as a surprise that we’re very big on it. There are all kinds of great plugins for speeding up WordPress. Personally, I’ve found WP Rocket is hands down the best – which makes it unsurprising that it’s a premium plugin that costs a few bucks.
But one thing all of the myriad speed plugins have in common is a certain level of complexity. You need to have a basic understanding of how web servers work, what the difference between server and client side caching is, and even then most WordPress themes don’t like to have all the various options turned on.
Do you defer JavaScript, or minify it? Do those words even make sense to the average user? There’s a lot to take into account.
As a quick a dirty fix, just throw this code in your .htaccess file for your site:
<IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType application/pdf "access 1 month" ExpiresByType text/x-javascript "access 1 month" ExpiresByType application/javascript "access 1 month" ExpiresByType application/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 2 days" </IfModule> <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/x-font AddOutputFilterByType DEFLATE application/x-font-truetype AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/x-font-otf AddOutputFilterByType DEFLATE application/x-font-opentype AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE font/ttf AddOutputFilterByType DEFLATE font/otf AddOutputFilterByType DEFLATE font/opentype # For Olders Browsers Which Can't Handle Compression BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html </IfModule> <IfModule mod_headers.c> <FilesMatch "\.(js|css|xml|gz)$"> Header append Vary: Accept-Encoding </FilesMatch> </IfModule>
BOOM.
Yes it’s quite a lot of code, but for 98% of WordPress sites it will immediately make your site run faster, score more highly on speed tests, and (barring that other 2%) is fool proof. It’s the fastest way to make WordPress fast.
(If you’re looking for where to stick it, assuming you use the most common server setup the .htaccess file just sits in the top level of your live site’s file directory.)
