Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would I be able to correctly redirect a person who visits my site to my 404 page? I have already created my 404.php file as:

<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Page not found | Twilight of Spirits</title>
<link rel="stylesheet" href="">
<link rel="icon" type="image/x-icon" href="/favicon.png">
<div id="error">
  <a href="">
    <img src="/forum/template/default/images/layout/404.png" alt="404 page not found"   id="error404-image">

<div id="mixpanel" style="visibility: hidden; "></div></body></html>

My .htaccess file is:

ErrorDocument 404

Now when I go to my site and enter a false link such as mack.php or total.html, I get this error:

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Any ideas on how to solve this? I have tried switching from subdomain to my normal path, still get errors.

share|improve this question

migrated from Nov 9 '12 at 21:47

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

I don't know if it solve your problem but you should set the 404 header on top of your site.

header("HTTP/1.0 404 Not Found");

Perhaps you have an error on your site. Check the apache error log to get some more information.

header('HTTP/1.0 404 Not Found'); not doing anything

share|improve this answer
I have tried your method, aswell as icktoofay's. I still get the same error. I also moved the two from forum and put them inside my root. Changed the paths in both files, and its still an error. Its a possibility that its my hosts settings. I will look into it thanks. – Evylent Nov 9 '12 at 13:18
look at the post from @moonwave99 this is a good solution. – Stony Nov 9 '12 at 13:19

You have to provide a local path, e.g. ErrorDocument 404 404.php.

share|improve this answer

If I remember correctly the 404 document may not point to a full URL, only to a relative path.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.