1
votes

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

1
What is your error message? - Marco Aurélio Deleu
Error message is 404 not found - f4r4
Have you checked namespace? - Bishnu Bhusal

1 Answers

0
votes

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;