Jump to content

Recommended Posts

Posted

Hi all,

Is it possible to use PHP pages as error handlers (e.g. 404, 500 etc) instead of the default SHTML pages? The rest of my site uses PHP, so this would make life a bit easier.

Thanks in advance,

Cal McLean

Posted

You can specify which documents respond to particular codes by adding them to a .htaccess file. Note that .htaccess files are generally inherited by child directories - so if you put it in your public_html directory (i.e. the top-level directory of your site), then all child directories should follow the rules too.

 

So to add custom 404 (Not Found) pages, you'd use something like:

ErrorDocument 404 /my-amazing-4oh4-page.php

 

When I say ".htaccess files are generally inherited by child directories..." this has just generally been in my experience; thinking about it, I actually don't know if that is related to how a given HTTPD is configured, whether it's default Apache behavior, or what. But it will most definitely apply to the directory in which the .htaccess file is located.

Posted

This actually correct but in some server Apache i think you need to put like this

when i just add the single line code it did't worked from me on Stevie

 

<IfModule mod_rewrite.c>
RewriteEngine On ErrorDocument 404 /404.php
</IfModule>

 

just change the 404.php to your page

 

You can check this link once steve gets back on track as my website is on Stevie

http://techstream.or...gining/404_page

 

You can make some creative pages for 404

check mine http://techstream.org/404

 

for more check the above link

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...