How to Enable Browser Caching in cPanel
Posted about 4 months ago 4kWhy Browser Caching Matters
Faster repeat visits: Reduces server load and improves page speed.
Add to .htaccess
## EXPIRES 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 text/javascript "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresDefault "access 2 days"
</IfModule>
Verify It's Working
Browser Dev Tools
Network tab → Reload → Check 'Cache-Control' and 'Expires' headers.
Recommended Cache Times Table
| File Type | Cache Duration |
|---|---|
| Images (jpg, png, gif) | 1 year |
| CSS & JS | 1 month |
| HTML | 2 days (or no-cache) |
| Fonts | 1 year |