RewriteEngine On RewriteBase / RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) RewriteCond %{HTTP_USER_AGENT} libwww-perl.* RewriteRule .* – [F,L] RewriteCond %{QUERY_STRING} (\"|%22).*(<|>|%3) [NC,OR] RewriteCond %{QUERY_STRING} (javascript:).*(\;) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3) [NC,OR] RewriteCond %{QUERY_STRING} (\;|\'|\"|%22).*(union|select|insert|drop|update|md5|benchmark|or|and|if) [NC,OR] RewriteCond %{QUERY_STRING} (base64_encode|localhost|mosconfig) [NC,OR] RewriteCond %{QUERY_STRING} (boot\.ini|echo.*kae|etc/passwd) [NC,OR] RewriteCond %{QUERY_STRING} (GLOBALS|REQUEST)(=|\[|%) [NC] RewriteRule .* - [E=BadQueryString,F] RewriteRule ^ - [E=BASE:/] [L] RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTPS}:s on:(s) RewriteRule ^(.*)$ http%1://www.%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{REQUEST_URI} /admin/ RewriteRule .* - [S=2] RewriteRule ^(.*)index\.php$ %{ENV:BASE}$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([a-zA-Z0-9!-/]*)$ %{ENV:BASE} [L]