0

I'm trying to implement a customised 404 error page but this is what i get

**The requested URL /about/hdhdhdh.php was not found on this server.
  Additionally , a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request**

Inside my .htaccess I have this

    ErrorDocument 404 /404.php

both the .htaccess and 404.php are in the same directory. Please what could the problem be.

UPDATE

after removing the initial forward slash infront of 404.php.. It now looks like this

   ErrorDocument 404 404.php

I now get 404.php displayed on the screen when i enter an invalid link, meanwhile i have a well formatted 404.php page.

3
  • you could accept ethanh's answer, since you did what he said. Commented May 2, 2012 at 11:43
  • Not yet...it only displays "404.php" not the actual formatted page. Is there somthing i'm missing out? Thanks. Commented May 2, 2012 at 12:12
  • OK, that wasn't clear from your previous update, I thought it showed your custom 404.php-page Commented May 2, 2012 at 12:23

3 Answers 3

3

Don't put a slash in front of the 404.php

Sign up to request clarification or add additional context in comments.

Comments

1

I have solved this issue by hardcoding http://yourdomain.tld in front of the 404.php.

The reason that it otherwise won't work is due to the usage of the default error handling by your host, but your domainname has priority over that. So do this:

ErrorDocucument 404 http://yourdomain.tld/about/404.php  

The 404.php page can then be anywhere you like and define (in this example in the folder about. Your .htaccess can stay where it is.

Comments

0

Well, according to the manual you have to begin with a slash in front of the 404.php and use a complete path starting from your webroot.

Thus if your 404.php-file is in your about-folder, use this:

ErrorDocument /about/404.php 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.