การใช้ .htaccess เปิดใช้งาน lscache ใน Litespeed

โค๊ดอย่างง่าย สำหรับเปิดใช้งาน lscache ด้วย .htaccess ครับ

<IfModule LiteSpeed>
RewriteEngine On
CacheEngine on esi crawler
CacheEnable public /
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteRule .* - [E=Cache-Control:max-age=3600]
</IfModule>

วิธีตรวจสอบ ใช้ลองใช้งาน Debug header ดู แล้วหาค่า “x-litespeed-cache:” จะโชว์ขึ้นมา แสดงว่าโค๊ดเริ่มทำงานแล้ว

จากตัวอย่างด้านบน คือทำการตั้งค่าแคชไว้ที่ 3600 วินาที หรือ 1 ชั่วโมงครับ