Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !Mozilla [NC]
RewriteRule ^ - [F]


How do I block in my php code?

You can block abnormal access to your web application by adding below code on top of your code - it will be something like index.php

Code Block
# block abnormal connection
if (!preg_match("/^Mozilla\/(.+)/", getenv('HTTP_USER_AGENT')))
{
	http_response_code(404);
	exit;
}