23

Possible Duplicate:
How can I create an error 404 in PHP?

how to make my own 404 page not found error in my site so it looks better than the default
when someone accesses url like this www.blablabla.com/index99.php which is doesn't exist this will automatically redirected to my own 404 page thank beforehand

Community
  • 1
  • 1
Agung Setiawan
  • 1,134
  • 3
  • 13
  • 32
  • Your web server probably just has a template page you can replace, if it is only to be static output. – Michael Berkowski Mar 06 '12 at 03:42
  • What web server software are you using? It's fairly easy in most of them. Just search for "custom 404 [web server software]". – Norm MacLennan Mar 06 '12 at 03:43
  • 1
    It has nothing to do with php. You have either forward all requests with mod_rewrite (if you are using Apache) to the script which will check the existence of the requested page or setup http server. This is an example for Apache http://httpd.apache.org/docs/2.0/custom-error.html – Cheery Mar 06 '12 at 03:44
  • thank you for all of you, yes i'm using Apache web Server – Agung Setiawan Mar 06 '12 at 03:46

1 Answers1

60
  1. Make your own custom 404 page
  2. Make an .htaccess file and place it in your root
  3. Place this line inside the .htaccess file ErrorDocument 404 http://www.example.com/your-custom-404.php

Read more here

Charlotte
  • 111
  • 1
  • 9
Malitta N
  • 3,384
  • 22
  • 30
  • 22
    It's quite ironic and funny that the link you shared in step 2 gives a 404 error page =) but it doesn't matter, most of us won't need a guide on how to create a file... – T_D May 06 '13 at 19:07
  • 6
    the irony...linking me to an 404 error page.. :P – Floris497 Dec 17 '13 at 09:29