Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UI-Router give cannot GET error on page refresh

I am building an angular site and using UI-Router, if I click a link to go to a route it works fine but whenever I refresh the page, or if I type the url in manually I get 'Cannot GET /find-a-vendor. I have this in my routes file:

$stateProvider
   .state('home', {
      url: '/',
      templateUrl: 'views/home.html'
    })
    .state('find', {
       url: '/find-a-vendor',
       templateUrl: 'views/find.html'
    })

I also have $locationProvider.html5Mode(true); in my routes file as well. and in my index I have <base href="/"> in the header, is there something I'm missing?

like image 710
jmona789 Avatar asked Jul 31 '16 20:07

jmona789


1 Answers

I've had this issue before and found this article that helped me tremendously. You need to do some server side rewrites.

like image 59
tcasey Avatar answered Oct 21 '22 10:10

tcasey