Caching is done to speed up your website and alleviate the load on the server overall. Next to gzip-compression, caching is one of the most popular methods of web-optimization.
How to enable caching in cPanel
- Log into cPanel
- On the dashboard, click on File manager.
- Go to the public_html folder.
- By default, .htaccess is hidden. So click the Settings button and check the Show hidden files (dotfiles) mark.
- Now click on .htaccess and click Edit.
- Add at the beginning of the file:
<IfModule mod_expires.c> ExpiresActive On ExpiresByType application/javascript "access plus 10 days" ExpiresByType text/javascript "access plus 10 days" ExpiresByType text/css "access plus 10 days" ExpiresByType image/gif "access plus 10 days" ExpiresByType image/jpeg "access plus 10 days" ExpiresByType image/png "access plus 10 days" </IfModule>
- After you are done with the file, click on Save changes.