Your website can't just sit there– it needs to be updated to perform its best!…
Advanced WordPress Performance Techniques
Welcome back, i3 blog readers. Today, we’d like to share with you some advanced techniques that will help improve the performance of your WordPress site.
By now, most of you are aware of WordPress caching plugins and CDN services. At i3, we use Amazon’s robust Cloudfront service to distribute our web files across locations worldwide. This ensures quick loading regardless of a user’s location.
There are more advanced techniques that you can employ if you are tech-savvy and want to tweak your site to its fullest potential. Head over to your server’s .htaccess file (usually in the root of your website), and open it with your favorite text editor. Always remember to back up the original file to a safe location for later retrieval.
Adding the following code will allow a visitor’s browser to cache your images, css, javascript, and text files, leading to a faster site load the next time they visit:
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 month"
ExpiresDefault "access 1 month"
Easy, right? Now, those types of files will load almost instantly if a user comes back to your site within a month of their last visit. You can change the access time as needed, but 1 month is a good starting point.
If you add the above code and end up with a 500 server error, it means you have a typo somewhere. Revert your changes and double check your code!