1

I have no idea whats wrong with my code :/

Controller File - UserController.php

<?php
class UserController extends BaseController {
    public function getSomething() {
        echo 'It works!';
    }
}
?>

File - routes.php

<?php
Route::get('/', function(){       
    echo "Home route";             
});                               
Route::get('user', function(){
    echo "User route";
});

Route::get('foo', 'UserController@getSomething');
?>

first route - On route browser if I type

http://myurl.com/
http://myurl.com/index.php

first route work flawlessly

second route - On route browser if I type

http://myurl.com/user
http://myurl.com/index.php/user  

second route also work flawlessly

third - This doesnt work at all on either of this urls what Am I missing whats my mistake

http://myurl.com/index.php/foo
http://myurl.com/foo

PLEASE ADVICE

f4r4
  • 563
  • 8
  • 19

1 Answers1

0

It really looks like you have wrong web server configuration. Check if Apache/nginx config points web server to the public directory of Laravel project root.

Sample paths from here:

For Apache you can use these directives:

DocumentRoot "/path_to_aravel_project/public"
<Directory "/path_to_aravel_project/public">

For nginx, you should change this line:

root /path_to_aravel_project/public;
Community
  • 1
  • 1
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279