RewriteCond %{QUERY_STRING} stroka_v_url [NC]
$_SERVER['QUERY_STRING']
RewriteCond %{REMOTE_ADDR} !^123\.123\.(?:17[6-9]|18[0-9]|19[0-1])\.[0-9]{1,3}$
$_SERVER['REMOTE_ADDR']
и
!preg_match(/^123\.123\.(?:17[6-9]|18[0-9]|19[0-1])\.[0-9]{1,3}$/)
RewriteCond %{REMOTE_ADDR} !^222\.222\.(?:6[4-9]|7[0-9]|8[0-9]|9[0-5])\.[0-9]{1,3}$
- выше
RewriteRule ^.*$ - [F]
ErrorDocument 403 /block.html
можно
echo file_get_contents('/block.html'); exit;