Custom 404 Page

Discussion in 'Apache' started by cancer10, Mar 15, 2008.

  1. #1
    Hi,

    I am running cPanel 11 with apache.

    I want a custom 404 page in php format. Currently its set to 404.shtml by default, even if I change the file name from 404.shtml to 404.php (under cPanel's "Custom Error Pages"), it still redirects to 404.shtml. So I was wondering if there is an alternate trick to do this?


    Please guide



    Thanx
     
    cancer10, Mar 15, 2008 IP
  2. Randombase

    Randombase Peon

    Messages:
    224
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    .htaccess :
    ErrorDocument 404 /404.php
    Code (markup):
    Don't forget the beginning slash (/), otherwise it would search the file at wrong places :)
     
    Randombase, Mar 15, 2008 IP
  3. cancer10

    cancer10 Guest

    Messages:
    364
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That solved my problem.



    Thanx
     
    cancer10, Mar 15, 2008 IP
  4. IwhiC

    IwhiC Peon

    Messages:
    2,594
    Likes Received:
    61
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Good call. I was too late. Glad some one helped so Fast.

    Thank you
    Jason
     
    IwhiC, Mar 16, 2008 IP
  5. cancer10

    cancer10 Guest

    Messages:
    364
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    cancer10, Mar 21, 2008 IP
  6. Randombase

    Randombase Peon

    Messages:
    224
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Sorry for bump, but in IE a custom error page needs to be 512 bytes or bigger. If you can't reach this, add some hidden commented data like:
    <!-- Internet explorer sucks -->
    Code (markup):
    :)
     
    Randombase, Mar 27, 2008 IP
  7. peter_anderson

    peter_anderson Notable Member

    Messages:
    3,382
    Likes Received:
    152
    Best Answers:
    0
    Trophy Points:
    240
    #7
    peter_anderson, Mar 27, 2008 IP
  8. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #8
    If you do a redirect to your 404 page then the HTTP status codes that get returned are 302 followed by 200. If you use the ErrorDocument directive then you get a 404 HTTP status code.

    This won't make much difference to normal users viewing your site in a browser but it makes quite a big difference to search engine bots and automated scripts. A 404 "Page not found" will be treated differently by Google than a redirect to a normal page that tells you it can't find what you were looking for. If you do the redirect method and you have a lot of broken links on your site you could even find that your custom "Not found" page has the highest page rank on your site !
     
    Ladadadada, Mar 27, 2008 IP