Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why laravel 5.7 basic route redirect to 404?

i have install fresh laravel 5.7. now when i declare route in web.php. when i declare like

Route::get('foo', function () {
    return 'Hello World';
});

it redirect to 404 page but.. when i declare my root directory name along with route just like

Route::get('blog/foo', function () {
    return 'Hello World';
});

it shows me expected result..

but i don't want to define like that. i want to define like this and get the expected result

  Route::get('foo', function () {
        return 'Hello World';
    });

help me !

like image 445
Mh Dip Avatar asked Dec 28 '25 14:12

Mh Dip


1 Answers

It should work perfectly fine but try the following command and let me know if it fixes your issue

php artisan route:clear
like image 176
Rafay Hassan Avatar answered Dec 31 '25 03:12

Rafay Hassan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!