I started a node.js http-server - " https://www.npmjs.com/package/http-server " If i type a non existed file in the directory, than I get the browser msg:
This localhost page can’t be found
No webpage was found for the web address: http://localhost:8080/foo
Search Google for localhost 8080 foo
HTTP ERROR 404
My question: Can I customise this error msg somehow?
Create 404.html
file in your public
directory and put content you want to be shown to that file
Example
Command line
# http-server ./public/
Content of ./public/404.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>404</title>
</head>
<body>
<p>My custom 404 message</p>
</body>
</html>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.