mercredi 27 janvier 2016

How to make Laravel 5 redirect to Angular routes without the hash (#)?

I am using Laravel 5 with Angular.

By default Angular add /#/ to the URL.

I don't like that /#/ so I removed it using $locationProvider.html5Mode(true); from Angular.

Now whenever I try to visit an Angular URL, Laravel refuse to redirect me and instead it causes an error NotFoundHttpException saying:

Sorry, the page you are looking for could not be found.

NotFoundHttpException in RouteCollection.php line 161:

And this is very logical because the route is not defined in the Laravel's route file.

How to solve this?!

More Details:

  • When I visit http://ift.tt/1npFV65 everything works fine (laravel knows it's Angular route and then Angular get rid of the # so the URL become http://ift.tt/1SLoKJc without an error).
  • When I visit http://ift.tt/1SLoKJc Laravel display the error NotFoundHttpException.


from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1PkslLY
via IFTTT

Aucun commentaire:

Enregistrer un commentaire