Reputation: 303
I have a htaccess rewrite rule code which works on Apache but not on litespeed.
<Files "bg.js">
SetEnvIfNoCase User-Agent .*autoit.* search_robot
Order Deny,Allow
Deny from All
Allow from env=search_robot
</Files>
I want to block all useragents except those that are a case insensitive match to autoit
.
How do I get the rewrite rule to work on litespeed?
Upvotes: 0
Views: 1785
Reputation: 9007
Unfortunately, LiteSpeed does not support SetEnvIf*
directives in .htaccess
files. As an alternative, you'll need to use mod_rewrite
:
RewriteEngine On
# Check that the request is for /bg.js
RewriteCond %{REQUEST_URI} ^/bg.js
# Check that the request matches an existing file
RewriteCond %{REQUEST_FILENAME} -f
# Check that the user agent does not contain autoit
RewriteCond %{HTTP_USER_AGENT} !autoit
# If all conditions above are met, then deny access to this request
RewriteRule ^ - [F,L]
Upvotes: 3