Hi,
I have sen this posted on here before but I'm still having trouble with it. I've pasted the following code into my .htaccess file:
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##
I am still getting a message telling me to leverage browser caching whenever I run a page speed test.
Any ideas what I'm doing wrong?
Many thanks,
M&S
Solved! Go to Solution.
Hi M&S,
check the details - most likely there are some tracking or live chat scripts loaded from other servers listed there. your .htaccess can enable browser caching only for files loaded from your server.
hope this helps.
I agree with @Finestshops.
Make sure you check the details in PageSpeed and you will most likely see that all the resources listed are hosted externally and there's nothing you can do about them.
Unless your server isn't configured correctly, all your own contents should already be leveraging browser caching.
Hi M&S,
check the details - most likely there are some tracking or live chat scripts loaded from other servers listed there. your .htaccess can enable browser caching only for files loaded from your server.
hope this helps.
I agree with @Finestshops.
Make sure you check the details in PageSpeed and you will most likely see that all the resources listed are hosted externally and there's nothing you can do about them.
Unless your server isn't configured correctly, all your own contents should already be leveraging browser caching.
You have to enable 'enable mod_expires'. Type this command and restart apache server:
sudo a2enmod expires Enabling module expires. Run '/etc/init.d/apache2 restart' to activate new configuration!
Nice. This solved my problem.
Thanks this helped me too