I don't think the title is that clear, so I apologize.
Long story short, I wanted to make a website using http-server and ngrok. I created a 404 page to handle page not found errors. It worked, if the link is like localhost:8080/abc
; it didn't work (CSS styling doesn't apply, button doesn't work) if the link is like localhost:8080/a/b/c/
.
My directory is:
fonts //
images // Not important
pages //
scripts
404.js // This file has a function with 'window.location.href = "index.html";'
style.css // This is not important
index.html
404.html // This file has a button which is controlled by scripts/404.js
I want to make the 404 page work for whatever invalid URL the user put (example at the top), how can I do that?