How to force browser cache on my website?

Issue:

When you check your website using http header tools you can see that your website is not optimize.

Reason:

You find that your website is not optimize and you have check with webpage tester that your website is does not have caching enable.

Solutions:

You may force your website to use caching that has been ready by our web server. Please add below script into your .htaccess file:

ExpiresActive On
ExpiresDefault A1800

#   1 Week
<FilesMatch "\.(ico|gif|jpg|jpeg|png|flv|ttf)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
#   1 Week
<FilesMatch "\.(js|css|pdf|txt|swf)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
#   1 Hour
<FilesMatch "\.(html|htm|php|php3|)$">
Header set Cache-Control "max-age=3600"
</FilesMatch>

Was this answer helpful?

Also Read

My website is running slow

If you are using a forum or content management system, make sure that caching is enabled. Caching...

Why is SEO important?

SEO (Search Engine Optimization) enables your website to be more accessible by the search...

I'm receiving a blank page

If your website or web application is displaying nothing but a blank, white page, then chances...

Page is displaying 404 Page Not Found error

The 404 Page Not Found error means that the user requested a page on the server that does not...

How to disable mod_security in .htaccess?

Issue: Having 403 error page when uploading files to your directory using your CMS application...