Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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="http://forum.umbradora.net/template/default/css/404.css">
<link rel="icon" type="image/x-icon" href="/favicon.png">
</head>
<body>
<div id="error">
  <a href="http://forum.umbradora.net/">
    <img src="/forum/template/default/images/layout/404.png" alt="404 page not found"   id="error404-image">
  </a>
</div>


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

My .htaccess file is:

ErrorDocument 404 http://forum.umbradora.net/404.php

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, webmaster@umbradora.net 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 stackoverflow.com Nov 9 '12 at 21:47

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

3 Answers 3

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.

<?php
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

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

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

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