Caching stores copies of your website's content so that subsequent requests can be served faster. Effective caching reduces server load, speeds up page loading times, and improves the experience for your visitors.
Please note: Screens and options may vary slightly depending on your cPanel version and hosting plan.
Types of Caching
Browser Caching
Tells visitors' browsers to store static files (images, CSS, JavaScript) locally. When they return to your site, these files load from their cache instead of being downloaded again.
Enable via .htaccess:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
</IfModule>
Server-Side Page Caching
Stores generated HTML pages so the server doesn't need to run PHP and database queries for every request.
For WordPress, popular caching plugins include:
- LiteSpeed Cache — Best if your server runs LiteSpeed (check with your host).
- WP Super Cache — Simple and effective.
- W3 Total Cache — Feature-rich with many configuration options.
Opcode Caching (OPcache)
PHP OPcache stores compiled PHP scripts in memory, eliminating the need to parse and compile them on every request. OPcache is usually enabled by default. You can verify via a phpinfo() page.
Object Caching
Stores the results of database queries in memory (e.g. using Redis or Memcached). This is particularly effective for database-heavy applications.
Availability depends on your hosting plan. Check with your provider.
CDN (Content Delivery Network)
A CDN distributes your static content across servers worldwide, serving files from the location nearest to each visitor.
Popular options:
- Cloudflare — Free tier available. Also provides DNS, SSL, and security features.
- KeyCDN, BunnyCDN — Pay-as-you-go CDN services.
Enabling Gzip/Brotli Compression
Compression reduces the size of text-based files (HTML, CSS, JS, JSON) before they're sent to the browser.
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE text/css application/javascript
AddOutputFilterByType DEFLATE application/json application/xml
AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>
Quick Performance Checklist
- Enable browser caching for static assets.
- Enable gzip compression.
- Install a page caching plugin (for WordPress/CMS sites).
- Optimise images (compress, use WebP format, lazy-load offscreen images).
- Minify CSS and JavaScript files.
- Reduce the number of plugins/extensions.
- Optimise your database regularly.
- Consider a CDN for global audiences.
- Use the latest supported PHP version (newer versions are significantly faster).
Tips
- Test your site's performance before and after implementing caching using tools like Google PageSpeed Insights, GTmetrix, or Pingdom.
- Be careful with caching on dynamic sites (e-commerce, membership sites) — you may need to exclude certain pages from caching.
- After making changes to your site, clear the cache to ensure visitors see the latest version.
What Next?
- Understanding .htaccess Files — Implement caching rules manually.
- Selecting and Configuring PHP Versions — Use the latest PHP for better performance.