Treatment of non-existent routes – trivial attacks

Member | 64

I've been seeing trivial attempts by attackers to get into our application assuming it is a WordPress site. It often looks like a request to the following URL:
This then results in an exception with a log entry containing following:
Nette\MemberAccessException: Cannot read an undeclared property Nette\Security\User::$user_role_id. in /home/m/ourapp/www/is/vendor/nette/utils/src/Utils/ObjectMixin.php:173
How to treat such a thing so that the application (server) returns the HTTP code 404 Not found?
Thank you for the advice.