After resolving webpack packaged vue project, after the deployment is complete, refresh the page page 404

1.url not acting
url completely immobile, namely how to change your page, how to jump url will not change. The principle of this case is that after page to get pure ajax to replace the original elements of the page, refresh the page is Home

2. With a hash (#) type
this in relation to the first page, then refresh the page without losing the
    realization of the principles of
writing a window listener event I change url, then I will be able to route real, so I can vary depending on the url , to render the page, a page corresponding to a url, will not repeat the request parameters ajax.
window.addEventListener ( 'hashchange', function () {
self.urlChange ()
})

3. No hash (#) style
of this type is the latest history api html5 to achieve the normal fallback forward, ultra-hi

So the question is
the first way the page is not refreshed, the second refresh it anyway, because url has not changed, still from the server can request url to the page loading.
But third on the problem, and I will refresh loading a page, it reported less than 404 pages missing. How to do it? ? ?

Solution
Program a
background control program entry 404 is forwarded to the index.html page, the page can make normal display through.
Scheme II
configuration server through nginx

Can refer to a single page at vue page refresh mode routing solutions
http://www.cnblogs.com/kevingrace/p/6126762.html 

 

Reprinted address: https: //blog.csdn.net/u013234218/article/details/70170837 

Guess you like

Origin www.cnblogs.com/sweeeper/p/11457886.html