A way to make custom 404 page for glitch website applications?


#1

Im wondering how to make a custom 404 page, I’ve searched online and found you need a file called .htaccess
and type ErrorDocument 404 (location of error 404 document)/error404.html And it doesnt work. Any help is appreciated.


#2

You can’t use a .htaccess file on Glitch. One way to do it is to use Express and set the last route to be one that catches everything that hasn’t already been handled by a route. So in https://glitch.com/edit/#!/simplistic-farmer for example, I have a route for ‘/’, the homepage, which renders: https://simplistic-farmer.glitch.me/ but if I try going to https://simplistic-farmer.glitch.me/gfdgdfgfdg it shows 404, because of the app.get('*' on line 19: https://glitch.com/edit/#!/simplistic-farmer?path=server.js:19:1


#3

Thank you! But what about making a complete separate page for it though like they will be redirected from https://simplistic-farmer.glitch.me/gfdgdfgfdg to https://simplistic-farmer.glitch.me/404.html or showing that HTML page.


#4

I’ve updated the example to use a page, see https://glitch.com/edit/#!/simplistic-farmer?path=server.js:18:0


#5

Thank you so much! Helped alot!