简体   繁体   中英

AngularJs Page Refresh Gives 404 Page not found on server

this routing working fine on loaclhost . but when I deploy my application on server and refresh any page it shows error of 404 error page not found. below is my routing

$routeProvider
           .when("/", {
               templateUrl: "/views/login.cshtml"

           })
            .when("/Login", {
                templateUrl: "/Views/login.cshtml"

            })
            .when("/adminlogin", {
                templateUrl: "/views/login.cshtml"

            })
            .when("/Register", {
                templateUrl: "/Views/Register.cshtml"
            })


            .when("/blue", {
                templateUrl: "blue.htm"
            }).otherwise('/', {
                redirectTo: '/'
            });
        $locationProvider
          .html5Mode(true)

anyone knows the solution kindly share.

Maybe , U need rewrite route mapping on server side and return index page

   routes.MapRoute(
                name: "Default",
                url: "{*url}",
                defaults: new { controller = "Home", action = "Index" }
            );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM