for a project with multiple pages, how to jump to the 404 page written by yourself when you enter the wrong url? is it set on the server side?
is it possible to use JavaScript?
for a project with multiple pages, how to jump to the 404 page written by yourself when you enter the wrong url? is it set on the server side?
is it possible to use JavaScript?
js certainly can't do it. Server processing. He's looking for resources. Found the return found, can not find the return of a default resource, you think 404
. Now it's time for you to give him the 404 you prepared. Just configure it
of course, you just want to judge whether it exists or not. And decided to jump. You can use ajax to request. If you can ask for it. If you do not see the return value of 404, you are doing your operation
Front-end routing can be implemented
and js
have nothing to do, because you are not a web service provided by js
. Depending on what is installed on your server, nginx
, try_files
is specifically for this purpose.
vue, but this is a single page
const router = new VueRouter({
mode: 'history',
routes: [
{path:'login', component: Login},
//
{ path: '*', component: NotFoundPage }
]
})
The 404page should be a url, backend visited by your front end that cannot be found, so you will be returned to the configured 404page, and the status code will be changed to 404at the same time.
I think the key is how you define "error" and where the error is judged.
it is recommended that the operation and maintenance staff configure the nginx error page to jump to the specified page! Avoid making two page jumps
this depends on how the project is made up
configure the page specified by 404 in the server. The ngnix, I use is matched in the configuration file to ok
configure 404 Global Jump specified Page under nginx:
under http module:
http{
fastcgi_intercept_errors on;
proxy_intercept_errors on;
.....
}
under server module:
server {
error_page 404 = https://your 404 page url;
}
first of all, there is such a piece of data list[ zhangsan , lisi , wangmazi ] people[ { name: zhangsan , username: },{ name: lisi , username: },{ name: wangmazi , username: } ] then the qu...
Welcome to see you media transform to aidem ouy ees ot emocleW ...
the customer responds that the browser loads the page slowly, and html can load all files normally, but it just shows how to troubleshoot the problem when the page is slow. ...