Skip to content

Instantly share code, notes, and snippets.

@ewg118
Created February 17, 2026 16:28
Show Gist options
  • Select an option

  • Save ewg118/fc8b0cb305a6d733f95b6792e0ced50a to your computer and use it in GitHub Desktop.

Select an option

Save ewg118/fc8b0cb305a6d733f95b6792e0ced50a to your computer and use it in GitHub Desktop.
Apache config for blocking old user agents
SetEnvIf User-Agent "Mozilla/[1-3].*" badbot
SetEnvIf User-Agent "Ubuntu/1*" badbot
SetEnvIf User-Agent "Android [1-4]\." badbot
SetEnvIf User-Agent "iPhone OS [0-6]_" badbot
SetEnvIf User-Agent "Mac OS X 10_[0-6]_" badbot
SetEnvIf User-Agent "Windows NT [1-6]\..*" badbot
SetEnvIf User-Agent "Safari/[1-4][0-9][0-9]\..*" badbot
SetEnvIf User-Agent "Chrome/[0-6][0-9]\." badbot
SetEnvIf User-Agent "Windows 9.*" badbot
SetEnvIf User-Agent "Windows CE.*" badbot
RewriteCond %{ENV:badbot} ^1$
RewriteRule ^ - [F]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment