I am Learning laravel now.
Today I came across a problem that surprised me. I open this link in my browser: http://localhost/laravel/project/ch/resources/views/pages/blog.blade.php And I expect error 404. but it opens contains of this file.
So, How to restrict laravel to do this.
I want laravel to open only url mentioned in routes.otherwise error 404.
Best How To :
This is because you access your site from
http://localhost. Every file and folder that is inside your root folder is accessible via the browser.
So don't run your project from localhost but from a proper virtual host. For example make
http://project.dev and use that to access your site
That way you won't be able to access
resources/views because it is outside of your document root. (one folder higher than public folder)
You can also upload your site to a webhost and see that you won't be able to access files and folders above your public folder in the browser.