angular.js - Angular2 is deployed to IIS, routing is invalid
曾经蜡笔没有小新2017-05-15 17:11:58
0
4
722
I deployed the project to IIS, but the routing does not take effect when accessing. After entering the address directly, it does not jump to the response page, but displays 404
If it is a purely static file, IIS will look for the file in the corresponding directory based on the routing. If it cannot be found, it will naturally result in a 404. There are two ways to solve it:
Write a background route that renders the page. All routes return a page, such as index.html, and then the page can capture the route and handle it by itself
Set the url rewrite of IIS, you need to download this from Baidu
Yes, the server does not have the resource corresponding to the address, and all requests must be redirected to the homepage
url rewrite
Set up?Nginx
用的多,IIS
I don’t know how to write it... The principle is similarDid you use html5 pushstate but forgot to set the routing pointer on the server side?
If it is a purely static file, IIS will look for the file in the corresponding directory based on the routing. If it cannot be found, it will naturally result in a 404.
There are two ways to solve it:
Write a background route that renders the page. All routes return a page, such as index.html, and then the page can capture the route and handle it by itself
Set the url rewrite of IIS, you need to download this from Baidu