Speed Up Website using `.htaccess` with Expire HeadersIvy Pritz
While there are many different things you can do in order to make your site faster I’m going to post a little snippet to add in your .htaccess file that will set your Expire Headers time.
The faster your site loads the better is for your SEO and for your Bounce Rates.
Expire Headers is letting your browser to cache your website content and request them only after the time specified in that rule expires.
If you want to set Expire Headers for all of your image,js and css file you have to open and edit your .htaccess file and the following rule:
FilesMatch sets the file extensions that are affected by the ExpiresActive rule while the ExpiresDefault sets the cache time, when that time expires then your website visitor browser will request once more the files.
ExpiresDefault is access time (A) plus 30 days (2592000 seconds), so using the same rule you can set your own ExpiresDefault time(just be careful to calculate in seconds).
If you want to set a separate Expire Headers rule for each of your filetypes then you can use the following snippet on your .htaccess.
ExpiresByType image/png A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/css A2592000
How useful was this post?
Click on a star to rate it!
Average rating / 5. Vote count: