
LiteSpeed Cache Configuration for Dynamic Sites
LiteSpeed is a high-performance web server that includes built-in page caching. If your hosting provider uses LiteSpeed (many shared hosts do), you can get significant performance improvements with just a few .htaccess directives. Here's the configuration I use at DailyWatch . Basic LiteSpeed Cache Setup Add this to your .htaccess file: < IfModule LiteSpeed > # Enable public caching CacheEnable public / CacheLookup on # Default TTL: 1 hour CacheDefaultExpire 3600 # Don't cache admin or API routes RewriteEngine On RewriteRule ^admin - [E=Cache-Control:no-cache] RewriteRule ^api/ - [E=Cache-Control:no-cache] RewriteRule ^task/ - [E=Cache-Control:no-cache] </ IfModule > The <IfModule LiteSpeed> block ensures these directives only apply when LiteSpeed is the server. Apache will safely ignore the entire block. Route-Specific Cache TTLs Different pages have different freshness requirements: < IfModule LiteSpeed > CacheEnable public / CacheLookup on # Home page and category pages: 3 hours < L
Continue reading on Dev.to Webdev
Opens in a new tab



