PerformanceCacheLiteSpeed6 min read

Optimize your website speed

LiteSpeed Cache, compression, image optimization, minification and Core Web Vitals.


Why speed matters

A fast website improves user experience, SEO and conversions. Google uses Core Web Vitals as a ranking factor. At Baires Host we use LiteSpeed servers that offer superior performance over Apache.

LiteSpeed Cache

LiteSpeed Cache is the caching system built into the server. For WordPress:

  1. Install the LiteSpeed Cache plugin from the WordPress repository
  2. Go to LiteSpeed CacheGeneral
  3. Enable page cache
  4. In CacheCache Control, activate:
  • Page cache
  • Object cache
  • Browser cache

For non-WordPress sites

Create an .htaccess file with cache directives:

apache
# Enable browser caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
</IfModule>

Gzip/Brotli compression

LiteSpeed supports Brotli (better compression than Gzip) natively. Verify it is active:

apache
# In .htaccess
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json
</IfModule>

Image optimization

Modern formats

  • Convert images to WebP or AVIF (30-50% lighter)
  • Use tools like Squoosh or the LiteSpeed Cache plugin (automatic optimization)

Lazy loading

html
<img src="image.webp" loading="lazy" alt="Description">

Explicit dimensions

html
<img src="hero.webp" width="1200" height="600" alt="Hero">

CSS and JavaScript minification

With LiteSpeed Cache for WordPress:

  1. Go to LiteSpeed CachePage Optimization
  2. Enable:
  • Minify CSS
  • Minify JS
  • Combine CSS (with caution)
  • Load CSS/JS asynchronously

Manual (without WordPress)

Use build tools like Vite, Webpack or esbuild to minify assets in production.

CDN (Content Delivery Network)

A CDN distributes your static content globally:

  1. Sign up for Cloudflare (free plan available)
  2. Change your domain nameservers to Cloudflare's
  3. Enable automatic optimizations
  4. Configure cache rules for static assets

Core Web Vitals

Key metrics that Google evaluates:

MetricGoodNeeds improvement
LCP (Largest Contentful Paint)< 2.5s> 4s
INP (Interaction to Next Paint)< 200ms> 500ms
CLS (Cumulative Layout Shift)< 0.1> 0.25

Improve LCP

  • Optimize the main image (hero)
  • Use preload for critical resources
  • Remove render-blocking CSS/JS

Improve CLS

  • Define dimensions on images and videos
  • Reserve space for ads and embeds
  • Avoid inserting dynamic content above the fold

Measurement tools

  • PageSpeed Insights: Complete analysis with recommendations
  • GTmetrix: Detailed loading waterfall
  • WebPageTest: Tests from multiple locations

Optimization checklist

  • LiteSpeed Cache enabled
  • Brotli/Gzip compression active
  • Images in WebP with lazy loading
  • CSS/JS minified
  • Browser caching configured
  • CDN active (optional but recommended)
  • Core Web Vitals in green

Was this guide helpful?