Skip to content
← Back to Community
page not found
Profile icon
dudemqn

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?

Voters
Profile icon
dudemqn
Comments
hotnewtop
Profile icon
xfinnbar

Not currently, but I have created a suggestion for Replit to add this: https://replit.canny.io/hacker-board/p/single-page-application-mode-for-html-repls-point-404s-to-indexhtml

Profile icon
dudemqn

@xfinnbar oh ok, thanks

Profile icon
QuickV

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

Profile icon
QuickV

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

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

Profile icon
dudemqn

@QuickV epic xd

Profile icon
QuickV

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

Profile icon
dudemqn

@QuickV sadness is die

Profile icon
QuickV
Profile icon
dudemqn
Profile icon
QuickV
Profile icon
dudemqn
Profile icon
QuickV

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

Profile icon
JakeHu2020

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

Profile icon
CosmicBear

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

Profile icon
OldWizard209

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.

Profile icon
dudemqn

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

Profile icon
QuickV

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

Profile icon
dudemqn

@QuickV oh okay

Profile icon
QuickV

yeah ^^ @dudemqn

Profile icon
QuickV

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