Open Closed

angularjs and html5 url 404 error #555


0
max created

hi, I am using angularjs and ui.router and I activated " $locationProvider.html5Mode (true ) ; " but I have a problem when I do refersh page : the browse show 404 error .. any solution?

br

Max


2 Answer(s)
  • 0
    marcosli created

    If you are using IIS you need to install URL Rewrite and make some modifications on the web.config.

    I followed this [http://www.advancesharp.com/blog/1191/angularjs-html5-mode-reloading-page-not-found-solution]) but is still not working.

    If you find a solution, could you post it here?

    Thanks!

  • 0
    thechrismarsh created

    Make sure you inject the location provider to the config ...

    appModule.config([
        '$stateProvider', '$urlRouterProvider', '$locationProvider',
        function ($stateProvider, $urlRouterProvider, $locationProvider) {
    
            $locationProvider.html5Mode(true);
    

    Also make sure you add this to the head of the layout.cshtml view ...

    <head>
    	<base href="/">
    

    following these two steps alone worked for me ... /Application#/host/tenants turns into /host/tenants