Setting Expires header in .htaccess to improve your page load time
- Created: Saturday, 12 January 2013 14:10
- Last Updated: Sunday, 17 February 2013 17:34
- Hits: 1474
If you check the performance of your site using any of the site speed analyzers like page insights, you can find the most important suggestion they will be giving would be to set Expires header so that the browser can use the cached copy. You can set the expires header for your site with a few lines of configuration in .htaccess file.
Pre-requisites : mod_expires.c should be enabled
in your server. Most of the hosting services will have made this enabled. To set an expires header to your static files, add the below code to your .haccess.
ExpiresDefault "access plus 1 year"
If you analyse your site using the tools again, you can see the expires header set.