0

my Angular Code for stateProvider

 .state('profile',{
    url: '/profile',
    templateUrl: 'Templates/profile.html',
    controller: 'profileCtrl'
})


 .state('profile.details',{
        url: '/:id',
        templateUrl: 'Templates/profile.details.html',
        controller: 'profileCtrl'
    })

when i write this in chrome bar http://localhost/site/profile/1

Apache Response is The requested URL /site/profile.html/1 was not found on this server.

but if i click on ui-sref link it's open well

Mohamed
  • 3
  • 3
  • 1
    Possible duplicate of [Refreshing page gives "Page not found"](http://stackoverflow.com/questions/14168836/refreshing-page-gives-page-not-found) – 31piy Mar 19 '17 at 13:41

1 Answers1

1

Because you're using client side routing, it is responsability of whatever server side technology you're using (Node.js, Rails, Django, ASP.NET...) to have a * (catch all) route that would accept everything and just render the same thing (your HTML with the bundle.js) and let the client to decide what to render.

Andre Pena
  • 56,650
  • 48
  • 196
  • 243
  • Also it's worth noting if the [`$locationProvider`](https://docs.angularjs.org/api/ng/provider/$locationProvider) settings has [`hashPrefix `](https://docs.angularjs.org/api/ng/provider/$locationProvider#hashPrefix) enabled and [`html5Mode`](https://docs.angularjs.org/api/ng/provider/$locationProvider#html5Mode) disabled, the url also requires the prefix in it to route to the correct state when first loading the url or refreshing the page via the browser. – cnorthfield Mar 19 '17 at 13:47
  • thats my demo link [link](http://www.egvision.net/staff) click on sign in and refresh the page, i changed my html5mode to false but it's didn't work. – Mohamed Mar 20 '17 at 08:04