Mobile app version of vmapp.org
Login or Join
Bethany197

: How to properly make a custom 404 page in apache2 My .htaccess ErrorDocument 404 http://www.mywebsite.com/error_404.php My error_404.php header <?php header("HTTP/1.1 404 Not Found");?> Redirection

@Bethany197

Posted in: #Html #Php #Seo

My .htaccess

ErrorDocument 404 www.mywebsite.com/error_404.php

My error_404.php header

<?php header("HTTP/1.1 404 Not Found");?>


Redirection works well but it seems like this configuration is not accepted by Google, This is a random page Google Webmaster Fetch

HTTP/1.1 302 Found
Date: Sun, 13 Dec 2015 11:19:57 GMT
Server: Apache
Location: www.askcyan.com/error_404.php Content-Length: 220
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://www.mywebsite.com/error_404.php">here</a>.</p>
</body></html>

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Bethany197

1 Comments

Sorted by latest first Latest Oldest Best

 

@Phylliss660

You want:

ErrorDocument 404 /error_404.php


Don't put the absolute URL in there - that's what's causing the redirect. Also, you don't need to set the 404 header through PHP - Apache will do that for you.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme