Ask coding questions

← Back to all posts
How do you make a 404 page
Korbindev (134)

Just as the title says how do i make a 404 page and link it to my website?

Answered by Coder100 (18092) [earned 5 cycles]
View Answer
Comments
hotnewtop
Baconman321 (1097)

Ok, let's get technical.

This really depends on what you are using.

An HTML,CSS,JS repl's server is handled by repl.it itself, so as far as I know you have no control over it.

If you are to use a server like nodejs, you can check the request itself. If no matching file is found to be able to be served you can send a 404.

I use GoLang nowadays for backend. Golang is a bit harder. With Golang as far as I know you would to check if the directory exists and send custom data as a 404 if it doesn't.

Apache is possibly the easiest with their .htaccess in which you can link custom error pages in the case that the server returns an error (like 404).

In reality, you would have to manually check if the file exists (the file you are serving) and if not send a 404 along with some data.

That's how 404's are handled.

RYANTADIPARTHI (6017)

you don't have to, if this is in HTML, css, and js. It has a default. So you are all set.

adsarebbbad (216)

what language and framework are you using?

JBloves27 (1882)

You have to make a seperate file. Like this:

404.html

Later on, you can import this html file and use it. I hope this helps!

Korbindev (134)

@JBYT27 yes but how i have 404.html made

JBloves27 (1882)

make a new file and name it that @KorbinVanette

Korbindev (134)

@JBYT27 i have it made how do i use it as 404 tho

JBloves27 (1882)

It seems like there is already a default. Try going to templates maybe and search it up there.
I hope this helps! @KorbinVanette

KellerWorthen (41)

unfortunately, there is currently no way to do this on repl.it