How do I make a 404 page with HTML?

Question: By default, the Replit 404 page says “Not found.” I was wondering if it was possible to write code that redirects you to a 404 page if the requested page does not exist.


Repl link: https://coderoad-preview.somerandomktpag.repl.co

<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width">
	<title>Wrong Page!</title>
	<link href="/style.css" rel="stylesheet" type="text/css" />
	<link rel="icon" type="image/x-icon"
		href="https://cdn.discordapp.com/attachments/989520779035177011/1023383840753979463/New_Project__2_-removebg-preview.png">
</head>

<body>
	<header>
		<nav id="nav-bar">
			<ul>
				<a href="/index.html">
					<img class="logo"
						src="https://cdn.discordapp.com/attachments/989520779035177011/1023322990613626890/jpg-removebg-preview.png"
						height="60" alt="Code road logo">
				</a>

				<a href="/index.html">
					<li id="home">Home</li>
				</a>
				<a href="/courses.html">
					<li id="courses">Courses</li>
				</a>
				<a href="/resources.html">
					<li id="resources">Resources</li>
				</a>
			</ul>
		</nav>
	</header>
	<h1 class="red">Oops!</h1>
	<h3>It appears that this Coderoad page you are looking for doesn't exist. Are you sure you have the right link?</h3>
	<h3>Try going <a href="/index.html">to the home page.</a></h3>
</body>

</html>
1 Like

Unfortunately no you can. Nothing in the docs and I tried making a 404.html file but to no eval.

You can request this feature by pressing the Share feedback button on the ? and then the button left navbar.
image

You might also want to look at tutorials like this Custom 404 Error Page in PHP : 5 Steps - Instructables as you would need to be running a server before you would be able to redirect to a 404 page anyway.

1 Like

You can try out this template which includes custom 404 pages.

2 Likes