Skip to content

Instantly share code, notes, and snippets.

@finalwebsites
Created March 2, 2025 15:13
Show Gist options
  • Save finalwebsites/407ede3aed1db395957b2fd8c1de409c to your computer and use it in GitHub Desktop.
Save finalwebsites/407ede3aed1db395957b2fd8c1de409c to your computer and use it in GitHub Desktop.
Static 404 page template for WordPress
<!doctype html>
<html lang="nl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>404 - page not found</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<style>
body { background: #dedede; }
.page-wrap { min-height: 100vh; }
</style>
</head>
<body>
<div class="page-wrap d-flex flex-row align-items-center">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12 text-center">
<span class="display-1 d-block">404</span>
<div class="mb-4 lead">Sorry, this page or file doesn't exist (anymore).</div>
<a href="javascript:history.back()" class="btn btn-link">Go back</a><a href="/" class="btn btn-link">Home</a>
</div>
</div>
</div>
</div>
</body>
</html>
@finalwebsites
Copy link
Author

Use this template file to your WordPress child theme.
Add this code to your .htaccess file
ErrorDocument 404 /index.php?error=404
Or for NGINX change your error_page to
error_page 404 /index.php?error=404;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment