Scrolling through my nginx errors log today, I noticed few attempts to access /wp-login.php which I believe to be the wordpress login page
The server simply returns File not found. but I wanted to abort(404) instead
I tried to add this login in my Exception Handler like this
public function render($request, Exception $exception)
{
if($exception instanceof \Illuminate\Contracts\Filesystem\FileNotFoundException) {
abort(404);
}
return parent::render($request, $exception);
}
But this seems to be catching file storage not found exception
is there a way to catch file not found exceptions in the public directory?
I ended up making a page rule on cloudflare, I just hated seeing an error on my nginx log and some people scanning my Laravel app as if it's a WordPress app