Page not found while reload page during # removal
I have made changes in my index.html and app.js.
This is app.js file.
angular .module('assessmentApp', ['ngRoute', 'ngCookies', 'ngSanitize', 'timer', 'assets', 'youtube-embed']) .config(config) .run(run); config.$inject = ['$routeProvider', '$locationProvider', '$httpProvider']; function config($routeProvider, $locationProvider, $httpProvider) { /*$locationProvider.html5Mode({ enabled: true, requireBase: false });*/ $routeProvider .when('/', { templateUrl: 'views/home.html', controller: 'HomeController', controllerAs: 'vm' }) .when('/login', { templateUrl: 'views/login.html', controller: 'LoginController', controllerAs: 'vm' }) if(window.history && window.history.pushState){ $locationProvider.html5Mode({ enabled: true, requireBase: true, rewriteLinks: true }); } }
This is Index.html.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Assessment</title>
<meta name="description" content="">
<meta http-equiv=X-UA-Compatible content="IE=edge">
<meta name=viewport content="width=device-width,initial-scale=1">
<base href="/assessment/"></base>
</head>
</html>
Make sure your server is set so that it is returning your index.html
instead of a 404. In your nginx config for this site add:
error_page 404 =200 /index.html;
Alternatively, you can redirect like this:
try_files $uri $uri/ /index.html;
链接地址: http://www.djcxy.com/p/77694.html
下一篇: 在#移除期间重新加载页面时找不到页面