SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast xor's Avatar
    Join Date
    Jul 2001
    Location
    New Zealand
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ErrorDocument 404 problem

    I've added the following line to me .htaccess file...
    Code:
    ErrorDocument 404 /404.php
    ... and written a simple 404.php page to test it. Works fine on my webhost, but on my development machine I get an error message when I try to request a non-existent page. The error message says that the page 404.php can't be found (it's in the right place), and then says that a 404 Not Found error has also occurred. Must be some problem with the way I've got Apache configured, but I can't figure out what it is. Does anyone have any ideas, or suggestions where I could start looking?

  2. #2
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi :-),

    could you check your error_log file and post here the description of the error ?

    Also using into your httpd.conf ( in particular inside the directory directive of your document root )
    AllowOverride All
    Options All

    will make you sure that ErrorDocument and .htaccess are correctly interpreted.


    Thanks,
    :-) Andrea
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  3. #3
    SitePoint Enthusiast xor's Avatar
    Join Date
    Jul 2001
    Location
    New Zealand
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pippo
    Hi :-),

    could you check your error_log file and post here the description of the error ?

    Also using into your httpd.conf ( in particular inside the directory directive of your document root )
    AllowOverride All
    Options All

    will make you sure that ErrorDocument and .htaccess are correctly interpreted.


    Thanks,
    :-) Andrea
    Ah! Thanks pippo, I looked at the error log and figured it out. It was looking for a 404.php in the /htdocs folder, rather than the subfolder I have this site in. Odd that it happens on my machine but works fine on my host. It must be something to do with the document root set in Apache maybe. I'd still like to sort it out so that I don't have to remember to change the .htaccess file before I upload every time.

    Here is the entry from the log file:
    Code:
    [Thu Jun 05 17:06:33 2003] [error] [client 169.254.71.255] File does not exist: W:/Websites/Apache2/htdocs/tnzs/foo.php
    [Thu Jun 05 17:06:33 2003] [error] [client 169.254.71.255] File does not exist: W:/Websites/Apache2/htdocs/404.php
    The 404.php file should be in that htdocs/tnzs folder as well. Can you tell me what I need to do to my apache config file to make it act the same way that my host server does? Or maybe I won't be able to do it at all and still be able to host multiple virtual sites?

    Thanks!
    Donna

  4. #4
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes,
    /404.php is related to the document root ( ie htdocs ).
    So if the 404.php is elsewhere you have to specifiy the whole path that in your case is:

    ErrorDocument 404 /tnzs/404.php

    If you are running multiples sites on the same server I'd suggest to use the virtual host directives.
    Using them you will be able to customize a 404 script for each domain.


    Thanks,
    :-) Andrea
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  5. #5
    SitePoint Enthusiast xor's Avatar
    Join Date
    Jul 2001
    Location
    New Zealand
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool, many thanks pippo! I will look into the virtual host directives. You are a star!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •