Ask coding questions

← Back to all posts
page not found
dudemqn (3)

in html,css, and js, is it possible to create a "page not found" page, or will it be replaced with the default repl "not found" page?

Comments
hotnewtop
QuickV (132)

I can also make a black and white glitchified (or just normal) version of your current pfp if you want :D

QuickV (132)

Sorry for having to show your glitchified pfp here, but markdown doesn't work in other areas -_-... Anyways, HERE YA GO:

Hopefully I can get credit if you use it lol :)

QuickV (132)

sadness... It turns out you didn't use it as your pfp ;( @dudemqn

QuickV (132)

lol could you make it so in your profile description, "quickv" is turned into "@QuickV" @dudemqn

JakeHu2020 (34)

You can't with a basic HTML repl. you need to have a backend to do it, like:

const app = require('express')();

app.use((req,res)=>{
  res.sendFile(__dirname+'/404.html')
});

for express, and:

from flask import Flask, render_template
app = Flask(__name__)

@app.errorhandler(404)
def pagenotfound():
  return render_template('404.html')

for python

CosmicBear (56)

If you want a custom 404 page, you need to use a back-end server.

OldWizard209 (1643)

If you want to create a custom 404 page, hook your html file to a server and a public file containing the css. Then get the response's JSON code, and in there, the status code should be written. Make a simple if statement that when statusCode == 404, render a custom 404 page.

dudemqn (3)

@OldWizard209 uh can you explain that in a more understandable way?

QuickV (132)

That's already kinda the most understandable way to explain it lol. @dudemqn

QuickV (132)

You could style a page to show "page not found" using html and css...