Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How do I leverage browser caching according to Google PageSpeed Insights
Prosper
✭✭
How can I leverage browser caching according to Google PageSpeed Insights?
Leverage browser caching for the following cacheable resources (picture , javascript and css files)
0
Answers
This should come out of the box.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight - Thank you for your comment. I thought that I have to put the code below on the .htaccess file.
But I am not sure if the code works for Vanilla forum. Does it?
@Prosper, sorry, I don't use apache
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Ok thanks @hgtonight.
Does anyone know the right code to put on .htaccess file to leverage browser caching according to Google PageSpeed Insights?
To Enable Browser Caching You Have To Follow These Instructions
Login Your Cpanel : Go To Your Hosting Panel or Cpanel.
Find .htaccess File : Find .htaccess file in root directory.
Open .htaccess File : Open .htaccess file in your web browser.
Add IfModule Code : Add IfModule Code in your .htaccess file given below.
Save .htaccess File : Finaly save .htaccess file.
<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 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>
Source : http://webdeveloperbareilly.in/blog/seo/leverage-browser-caching.html
Try this, it's working for me!
<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 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>
Source
You can test if it works here.
https://www.giftofspeed.com/cache-checker/