Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Oct 2002
    Posts
    751

    Default 404.php instead of 404.shtml

    I tried saving a custom error page as 404.php, the page does get saved, but it doesn't work when I request a page that doesn't exist. ( I see the default server error page )

    I haven't been able to find out where the redirect to site's 404.shtml is being made (I guess when I change that to 404.php it would work)

    Anyone?

  2. #2
    Member
    Join Date
    Aug 2001
    Posts
    132

    Default

    The file needs to be shtml if you are using CPanel to set it up.

    You can include a php file in the shtml file, like this:

    <!--#include virtual="/error/404.php"-->

    where errror is a directory under public_html and 404.php is your php error file.

    Another way (if you are using certain bits of PHP that don't like to be wrapped by SSI) is to include an shtml file:

    <!--#include virtual="/error/404.shtml"-->

    and then put an .htaccess file into your error directory like this:

    <snip>
    RemoveHandler .shtml
    AddType application/x-httpd-php .shtml
    <snip>

    Apache will now think .shtml is php...

  3. #3
    Member
    Join Date
    Oct 2002
    Posts
    751

    Default

    Thanks Wallaby,

    I added the lines to the .htaccess file and it works

  4. #4
    Member
    Join Date
    Jan 2006
    Location
    Mulund, India, India
    Posts
    118

    Default

    What do you mean by <snip>?
    Nitesh Shah

    Cheap Managed Dedicated Servers - http://www.qualispace.com/managed-servers/index.html

Similar Threads & Tags
Similar threads

  1. 404.shtml to all sites
    By bsasninja in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 05-26-2009, 10:27 AM
  2. Error Document - 404.shtml
    By flashweb in forum cPanel and WHM Discussions
    Replies: 16
    Last Post: 06-03-2004, 11:57 PM
  3. 404.shtml is not displayed
    By strauberry in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 06-21-2003, 05:17 PM
  4. 404.shtml
    By jackal in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-13-2003, 06:19 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube