The history mode of vue routing is put on the server, and the module cannot be found when the page is refreshed. After modifying the nginx, the syntax error is reported on the white screen. What's the problem?

problem description

modified the route pattern of the vue project. There is no problem with the hash mode, and the server side will not recognize the front-end route after-sharp.

https://cloud.hfq.huift.com.cn/huiquan/-sharp/

https://cloud.hfq.huift.com.cn/huiquan/-sharp/shops

but due to a series of parameter problems with Wechat jump, the-sharp sign had to be removed, so he began to use history mode!
changes to the following form

https://cloud.hfq.huift.com.cn/huiquan/

other routes are

https://cloud.hfq.huift.com.cn/huiquan/shops

but after removal, there is no problem in entering for the first time, and there is no problem in switching routes!

but! Refresh will report the error that the module cannot be found

the environmental background of the problems and what methods you have tried

flipped through some documents ide/essentials/history-mode.html-sharp%E5%90%8E%E7%AB%AF%E9%85%8D%E7%BD%AE%E4%BE%8B%E5%AD%90" rel=" nofollow noreferrer "> https://router.vuejs.org/zh/g., modified the configuration of the nginx server

location /huiquan {
            root   html/ml/hfq.huift.com.cn;
            try_files /huiquan/an/index.html /hu /huiquan/;
            index ex index.html;
        }

but. Start to report this error again. The, unexpected token page is blank

.

clipboard.png

what result do you expect? What is the error message actually seen?

I hope the page can be displayed normally as in hash mode, in conjunction with Wechat"s server-side jump


official explanation to see ~ need backend to cooperate with server settings to redirect redirect


you need to direct your resources to the resource address, and then everything else will be directed to your index.html


try_files for you to refer to my

location / {
    try_files $uri $uri/ /index.html;
}

has the problem been solved? I have the same problem now.
the backend has configured try_files, on nginx but still reports syntax errors on the blank screen unexpected token

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea18df-1b64.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea18df-1b64.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?