To enable browser caching in cPanel, you'll need to edit the .htaccess file located in your website’s root directory.

  1. Log in to your cPanel account.

  2. Open File Manager and navigate to the folder where your website is installed (usually public_html).

  3. Locate and open the .htaccess file. If it’s not visible, enable “Show Hidden Files” in File Manager settings.

  4. Add caching rules by inserting code that defines expiration times for file types like images, CSS, and JavaScript.

Here’s a basic example of what to add:

 

<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/javascript "access plus 1 month"

</IfModule>

This tells the browser to store frequently used files locally, which speeds up page load times and reduces server load.

Was this answer helpful? 0 Users Found This Useful (0 Votes)