{"action":"opened","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/8732","labels_url":"https://api.github.com/repos/laravel/framework/issues/8732/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/8732/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/8732/events","html_url":"https://github.com/laravel/framework/issues/8732","id":76150702,"number":8732,"title":"RouteCollection match() doesn't handle directory's so throws a 404 instead of 403","user":{"login":"georgeescott","id":5006681,"avatar_url":"https://avatars.githubusercontent.com/u/5006681?v=3","gravatar_id":"","url":"https://api.github.com/users/georgeescott","html_url":"https://github.com/georgeescott","followers_url":"https://api.github.com/users/georgeescott/followers","following_url":"https://api.github.com/users/georgeescott/following{/other_user}","gists_url":"https://api.github.com/users/georgeescott/gists{/gist_id}","starred_url":"https://api.github.com/users/georgeescott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/georgeescott/subscriptions","organizations_url":"https://api.github.com/users/georgeescott/orgs","repos_url":"https://api.github.com/users/georgeescott/repos","events_url":"https://api.github.com/users/georgeescott/events{/privacy}","received_events_url":"https://api.github.com/users/georgeescott/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-13T22:43:57Z","updated_at":"2015-05-13T22:43:57Z","closed_at":null,"body":"I'm currently working on an application where i want to have a custom 403 error page when a user tries to access a directory (such as `/css/`).\r\n\r\nIn homestead the current implementation is to show the default nginx 403 page and laravel doesn't do anything. I've added the `error_page 403 /;` directive to my `.conf` file in `/etc/nginx/sites-enabled` and laravel is returning the 404 error page instead of the 403 error view i created, however it returns an HTTP status code of 403.\r\n\r\nIn `/src/Illuminate/Routing/RouteCollection.php` the `match()` function only handles routes and not directories so I modified the match() function to include this at the top:\r\n```\r\nif (is_dir($request->path()))\r\n{\r\n    throw new AccessDeniedHttpException;\r\n}\r\n```\r\n\r\nthen obviously importing the AccessDeniedHttpException class `use Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException;`\r\n\r\nwhich now handles the directory correctly and shows the 403 view and still returns the HTTP 403. I'm sure there's a better way of doing this, but i'm just testing the functionality behind using the 403 error pages.\r\n\r\nI'm wondering if this is deliberate to mimic hiding directory's existence, or if you'd consider adding this if i create a PR? I'm happy to provide further information/code if requested."}}