Paste following codes which Page You want to show 404.
Example:
PHP
<?php
http_response_code(404);
?>
<!DOCTYPE html>
<html lang="en">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
background-color: #D3D3D3;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.error-container {
text-align: center;
background-color: #fff;
padding: 20px;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
h1 {
font-size: 5rem;
color: #ff5733;
}
p {
font-size: 1.5rem;
color: #333;
margin-bottom: 20px;
}
a {
text-decoration: none;
background-color: #ff5733;
color: #fff;
padding: 10px 20px;
border-radius: 3px;
font-weight: bold;
transition: background-color 0.3s ease;
}
a:hover {
background-color: #e6482e;
}
</style>
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1.0">
<title>
404 Page Not Found
</title>
<link rel="stylesheet"
href="style.css">
</head>
<body>
<div class="error-container">
<h1> 404 </h1>
<p>
Oops! The page you're
looking for is not here.
</p>
<a href="https://horje.com">
Go Back to Home
</a>
</div>
</body>
</html>
<?php
exit;
?>
Build a Custom 404 Page | PHP URL/LINK Tutorial |
How to set a page as a 404 Status in PHP | PHP URL/LINK Tutorial |
How to add PHP File Get Content | PHP URL/LINK Tutorial |
How to add PHP cURL CURLOPT | PHP URL/LINK Tutorial |
How to load XML Sitemap URLs | PHP URL/LINK Tutorial |
How to get file size from a remote url in PHP | PHP URL/LINK Tutorial |
How to create a zip file from url using PHP | PHP URL/LINK Tutorial |
How to create a custom 404 page PHP HTML CSS | PHP URL/LINK Tutorial |
Type: | Php |
Category: | Web Tutorial |
Sub Category: | PHP URL/LINK Tutorial |
Uploaded by: | Admin |