So you want a custom 404 page for your project page, or just any subdirectory? Well, according the GitHub help page, “you must use a custom domain.”
Here’s how I did it:
- Create your normal 404 per the GitHub guide.
- Create your custom 404 page wherever you want it to be. I have one in my
- Add the following script to your normal 404 page:
Obviously, chang the URLs to match where you want it to go. And you could use
if...else if...else if etc. to have multiple 404s.
To make multiple (more than two) 404’s easier, I updated the code to look like the following: