Replace SetEnvIf with RewriteRule to block bad clients

Situation:

We use "SetEnvIf" in Apache to deny access to our site based on the user-agent, this does not work with LiteSpeed.

For example:

SetEnvIfNoCase User-Agent "^WebZIP" bad_bot
SetEnvIfNoCase User-Agent "^Xaldon WebSpider" bad_bot

deny from env=bad_bot

Is there any way to make this work in LiteSpeed?

Solution:

Just use a rewrite rule for this.

RewriteCond %{HTTP_USER_AGENT} ^(WebZIP|Xadon WebSpider) [NC]
RewriteRule .* - [F]

  • Rewrite Rules, User-Agent
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How do I enable GEOIP function for vhosts from httpd.conf?

You should configure your GeoIP database from LSWS web console, make sure to load the DB in...