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
某草草2017-05-15 17:13:58
Yes, the server does not have the resource corresponding to the address, and all requests must be redirected to the homepage
我想大声告诉你2017-05-15 17:13:58
url rewrite
Set up?
Nginx
用的多,IIS
I don’t know how to write it... The principle is similar
location / {
try_files $uri $uri/ /index.html =404;
}
淡淡烟草味2017-05-15 17:13:58
Did you use html5 pushstate but forgot to set the routing pointer on the server side?
漂亮男人2017-05-15 17:13:58
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