Laravel and AngularJS Routing Issue


I’ve got a small issue with routing with AngularJS using Laravel. When I have a url like and I refresh, it will load fine under the AngularJS UI Router, however, when I have and I refresh it shows the Laravel-side 404.

I have my web.php set-up like this:

Route::get("/", function(){
    return view("index");

Route::get('/{all}', function () {
    return view('index');

I also have $location.html5Mode(true); in AngularJS and also my <base /> and the routes are all defined accordingly.

Can anyone shed some light on this?


For future reference and people coming here from search results.

Route::get('/{all}', function(){
    return view('index');
})->where(['all' => '(.*)'])

A where is needed to catch all after the initial / This isn’t explicitly noted in the documentation:

Answered By – Tuim

Answer Checked By – Terry (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.