php - Restrict laravel to open url that is not in route -


i learning laravel now.

today came across problem surprised me. open link in browser: http://localhost/laravel/project/ch/resources/views/pages/blog.blade.php , expect error 404. opens contains of file.

so, how restrict laravel this.

i want laravel open url mentioned in routes.otherwise error 404.

this because access site http://localhost. every file , folder inside root folder accessible via browser.

so don't run project localhost proper virtual host. example make http://project.dev , use access site

<virtualhost *:80>    documentroot "/laravel/project/public"    servername project.dev </virtualhost> 

that way won't able access resources/views because outside of document root. (one folder higher public folder)

you can upload site webhost , see won't able access files , folders above public folder in browser.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -