Wordpress LScache Plugin: Separated cache based on value from PHP
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hello, I have custom 404 pages but they are almost same size as standard page. Bots crawl some archive that don`t exist and my server is using much more bandwidth. I want to detect if request is robot and pass some header via PHP. Then Litespeed cache should give my empty page to robots and real one to real visitors. How i can make this? So far, i made my function is PHP to detect if is robot on 404 requests. What is next? I`m using PHP version of ua-parser but they also have c++ version. Its very simple and accurate. Also updates are very often on regex logic. Why not including into Litespeed, so users can easily use this variables in many situations: Separated cache for robots or maybe based on browser family, eq: Chrome Also using into plugin, like Use Litespeed Mobile Detector for separated views Also blocking not-important crawlers eq: If is Spider and family != GoogleBot, return 404 Something similar as your GEO feature. Hm? Hi @batooo, Are the 404 pages generated by PHP? If not, you can just add rewrite rules to your rules section/.htaccess to rewrite the url to your 404 page. If they _are_ generated by PHP, you can create your own rewrite rule similar to our mobile vary. RewriteCond % HTTP_USER_AGENT USERAGENT_REGEX [NC] RewriteRule . - [E=Cache-Control:vary=isrobot] This rewrite rule will tell the server to cache all pages with a user agent that matches USERAGENT_REGEX with the isrobot vary. You can put this rule somewhere within the block. Let me know if any of these steps are confusing. Cheers, Kevin
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference