Reputation: 3192
Currently I get a 404 error, but it does not redirect to 404.php
Here are the contents of my index.php:
<?
header("HTTP/1.1 404 Not Found");
exit;
?>
<html>
<head>
<title>Index</title>
</head>
<body>
<h1>Index</h1>
<p>This is the homepage, but I'd like it to go to 404.php!</p>
</body>
</html>
Here is 404.php:
<html>
<head>
<title>404</title>
</head>
<body>
<h1>Page Not Found!</h1>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
<p>This is my test custom 404 page!</p>
</body>
</html>
Here is .htaccess:
ErrorDocument 404 /Users/me/folder/mamp/404.php
/Users/me/folder/mamp/404.php
represents the root document folder in MAMP preferences.
I have also tried the relative path of /404.php
and the URL of http://localhost:8888/404.php
in .htaccess. So far all the same result, a white page, issuing a 404 but no redirect.
From my reading this all combined should do the trick; still missing something it seems.
Upvotes: 3
Views: 2300
Reputation: 785721
Your use of ErrorDocument
is wrong here:
ErrorDocument 404 /Users/me/folder/mamp/404.php
You need to use path either relative path from DocumentRoot
OR use full URL starting with http
. So use:
ErrorDocument 404 /404.php
OR
ErrorDocument 404 http://domain.com/404.php
Upvotes: 1