Should I use browser caching in .htaccess file?

Gmeister4

Well-known member
Registered
Joined
Apr 19, 2016
Messages
178
Points
18
In the past I use browser caching in .htaccess file to create caches and speed up my websites but not sure it did help or not. My question is, should I use browser caching in .htaccess file or ignore it?
 

David Beroff

Well-known member
Registered
Joined
Jun 14, 2016
Messages
1,488
Points
63
Browser Caching helps you ask your browser not to reload static files, such as CSS, image, etc. This improves the speed from the user's browser, giving better website access speed.

For optimization, simply add the following paragraph to the .htaccess file on the root directory.

Code:
## LEVERAGE BROWSER CACHING ##
<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/javascript “access 1 month”
ExpiresByType application/x–shockwave–flash “access 1 month”
ExpiresByType image/x–icon “access 1 year”
ExpiresDefault “access 2 days”
</IfModule>
## LEVERAGE BROWSER CACHING ##
For me, it is necessary but you need to edit it to suit to your sites.
 
Latest Threads
Replies
0
Views
24
Replies
4
Views
205

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top