Nguyen Linh
Nguyen Linh

Reputation: 266

Laravel 4.2 : Route is conflict with subfolder name inside public folder

I'm got some problem with Route in Laravel 4.2. Here is details:

I have an example route:

 Route::get('users', function(){return 'some-thing'}); 

and the route still work normally at http:://localhost:8000/users.

However, when I create a subfolder inside public folder, its name is "users".

--public
  --users

That link didn't work and return the folder index. I know that is a big sercurity problem.

How to fix it? Can you please help me?

Upvotes: 1

Views: 766

Answers (1)

Devon Bessemer
Devon Bessemer

Reputation: 35337

I wouldn't say a huge security problem, if there is sensitive data in that folder, then it shouldn't be in "public". You could deny directory listings (assuming Apache virtualhost or .htaccess):

Options -Indexes

As in Laravel's (and most other frameworks') .htaccess file, it only uses the "Router" if the file or directory doesn't exist. This is common as shown below:

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Upvotes: 1

Related Questions