404 page. Please help me

I am making a error 404 page for my website and I don’t want to put a package.json or glitch.json or anything that will stop my website from being a static site. Does anyone know how?

I encountered this before on Scratch but i’m suggesting redoing your package project or whatever is becoming static

Sorry, this isn’t possible. You have to pay to make it 24/7 with 404. And besides, static sites aren’t always awake. They simply get more uptime than non-static sites, but do go to sleep still. Boosted apps get:

  • 24/7 guaranteed
  • more disk
  • more mem
  • no rate limits
  • no project hour usage

…and more. Please consider upgrading at glitch.com/pricing.

Don’t do that, it takes time, as you know. Why not chuck the static code in a folder and install some packs like express and then use routes to connect it?

1 Like

hm thats a good idea not gonna lie,but what if something goes wrong with it and everything gets corrupted

It can’t get corrupted. Unless you did some terminal magic.

1 Like

If only i had the powers of sonic 06 i’d be able to do that magical thing

1 Like

WDYM?

2 Likes

Unfortunately, making a 404 page in a static site is impossible. You need server-side work for this. You should consider using Node.JS or any other framework in a language you prefer, like PHP, Python, Ruby etc.

3 Likes

how do i do this? can you tell me or make a video

1 Like

Static sites (yes) do go to sleep sometimes and non-static sites are guaranteed to always be sleeping every 5 minutes

1 Like

Most of the people know it very well.

Example, please? If that is the case, it is a bug and you should contact Glitch Support with a link to the project.

I’m sure glitch is aware of it as it has been discussed in a topic. I can’t show an example but static-sites do go to sleep due to something on their end, but I won’t be contacting them, because it isn’t necessary.

Assuming your static site is in the views folder, the 404 page is saved at views/404.html, you have created a Node.js project, and have Express installed:

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

app.use(express.static(__dirname + '/views'));

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

app.listen(3000);

If confused, make a new hello-express project, replace all the files found in views with your static site’s files and replace the code found in server.js with the one above.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.