Home » Speed & Mobile » No Caching or Compression: Make Repeat Visits and Page Loads Faster
No Caching or Compression: Make Repeat Visits and Page Loads Faster
A fast page is mostly about not doing work twice. Three kinds of caching and compression do that:
- Compression shrinks text files (HTML, CSS, JavaScript, SVG) before sending them. Typical savings: 70–80 percent.
- Browser caching tells the visitor's browser to keep files like CSS, scripts, fonts and images, so the next page and the next visit do not download them again.
- Page caching saves the finished HTML of a page, so the server does not rebuild it from the database for every visitor.
Missing any of these makes a site slower than it needs to be, especially on mobile.
Step 1: check what is already on
PageSpeed Insights reports "Enable text compression" and "Serve static assets with an efficient cache policy" if these are missing. You can also check headers directly:
curl -sI -H "Accept-Encoding: br, gzip" https://example.com/ | grep -iE "content-encoding|cache-control|x-cache|cf-cache-status"
content-encoding: brorgzip→ compression is on.cache-control: max-age=...on CSS, JS and images → browser caching is set.x-cache: HITorcf-cache-status: HIT→ a cache served the response.
Step 2: turn on compression
Most hosts enable it already. If not:
Apache (.htaccess):
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json image/svg+xml
</IfModule>
nginx:
gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
Brotli compresses better than Gzip and is available on many hosts and every major CDN. Do not compress images like JPEG and PNG; they are already compressed.
Step 3: set browser cache lifetimes
Static files that rarely change can be cached for a long time. Apache:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType font/woff2 "access plus 1 year"
</IfModule>
Long lifetimes are safe only if file names change when content changes (style.css?ver=1.4 or style.4f9a2.css). WordPress adds version strings automatically; most build tools add hashes. HTML pages should have short lifetimes or none, so visitors always see current content.
Step 4: add page caching
For dynamic sites, page caching gives the biggest speed-up:
| Setup | Options |
|---|---|
| WordPress on shared hosting | LiteSpeed Cache (on LiteSpeed servers), WP Super Cache, W3 Total Cache, WP Rocket |
| Managed WordPress hosting | Built-in; usually no plugin needed |
| Any site behind a CDN | Cloudflare (with cache rules or APO), Bunny, Fastly |
| Static sites | Already "cached"; just serve through a CDN |
Exclude logged-in users, cart, checkout and account pages from page caching.
Step 5: minify and defer
Once the basics are in place:
- Minify CSS and JavaScript (most caching plugins and build tools do this).
- Load non-essential scripts with
deferso they do not block the page. - Remove CSS and JS for features you do not use.
Test after each change. Combining and minifying files occasionally breaks scripts that depend on load order.
Common mistakes
- Installing two caching plugins at once, which conflict.
- Caching cart and account pages, so visitors see each other's data.
- Setting long cache lifetimes on files without version strings, so updates never reach visitors.
- Compressing already-compressed files, which wastes CPU for no gain.
Frequently Asked Questions
My changes do not show up after enabling caching. What now?
Purge each cache layer: the page cache plugin, the server cache, the CDN and finally your browser (hard reload with Ctrl+Shift+R). Use versioned file names for CSS and JS so updates are picked up automatically.
Is minification worth it?
It helps a little on top of compression, usually a few percent. Compression and caching give much larger gains, so set those up first. Turn minification off if it breaks scripts.
Should logged-in users see cached pages?
No. Pages for logged-in users, carts and checkouts are personal and must not be cached and shared. Good caching plugins exclude them by default.
Found a mistake or still stuck? Contact us. See how we write and check these guides in our editorial policy, or read about DocumentGuy.