Custom 404 Page

Hi,
how hard can this be?
I have virtual servers, PHP, MySQL all running nicely so I thought Id creat a custom 404 page.
 dev server is called test
Http://test/index.shtml      works fine!
create  a simple "notfound.html"  page in root
basic .htacces  in root, one line

ErrorDocument 404 /notfound.html     ----- ( tried notfound.html, ./notfound.html, http://test/notfoind html as well)

So in root "test" all three files live, but I still get the standard "File Not Found" error page from Firefox and IE. Is this rocket science?

thk in advance
Aussie
Peter BettsRetiredAsked:
Who is Participating?
 
sleep_furiouslyCommented:
When you say "I put AllowOverrride All in the file as a test. No luck." do you mean you put it in the .htaccess file or the httpd.conf file?  (Needs to go in a <Directory> section in httpd.conf)

BTW, if you don't want to allow all overrides, in particular, for ErrorDocument the override needed is FileInfo.
0
 
Sam PanwarSr. Server AdministratorCommented:
Hi,

If you are using the IE then use the following configure to see actual error not friendly error.
   Internet explorer > Tool >Internet Options > Advanced > Turn off Show friendly HTTP error

0
 
Sam PanwarSr. Server AdministratorCommented:
What exactly does the error log say?  What do the relevant section of
your .htaccess file say?

If it is a *db* file, as opposed to a text file, you may have
compiled Apache using a different *db* library than your old
server.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Sam PanwarSr. Server AdministratorCommented:
ErrorDocument 404 /no-such-file.html

...then, when someone tries to access a non-existant file in that directory,
the "no-such-file.html" page will be displayed instead of the generic 404
error page.

Details on the Apache implementation are at:

  http://www.apache.org/docs/mod/core.html#errordocument 
0
 
Peter BettsRetiredAuthor Commented:
Hi,
the error log is simply saying the file does not exist.... well I Know that much :)

[Fri Apr 07 13:53:51 2006] [notice] Parent: Created child process 3388
[Fri Apr 07 13:53:52 2006] [notice] Child 3388: Child process is running
[Fri Apr 07 13:53:52 2006] [notice] Child 3388: Acquired the start mutex.
[Fri Apr 07 13:53:52 2006] [notice] Child 3388: Starting 250 worker threads.
[Fri Apr 07 13:54:09 2006] [error] [client 127.0.0.1] File does not exist: D:/WEBS/test/dummyname.html

It appears I have the syntax correct. Perhaps .htaccess is not being read at all? I put AllowOverrride All in the file as a test. No luck.

Aussie
0
 
Peter BettsRetiredAuthor Commented:
FYI Here are the entries in httpd.conf

<Directory "D:/WEBS">
    Options Indexes FollowSymLinks +Includes
    AllowOverride None
    Order allow,deny
    Allow from all
    AddOutputFilter INCLUDES;DEFLATE shtml
</Directory>
#
#
#

<VirtualHost *:80>
    ServerAdmin webmaster@ifg.com
    DocumentRoot D:/WEBS/test
    ServerName test
   #ErrorLog logs/dummy-host.example.com-error_log
   #CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
0
 
ahoffmannCommented:
> ErrorDocument 404 /notfound.html

and the file can be found in D:/WEBS/test/notfound.html ?
0
 
Peter BettsRetiredAuthor Commented:
yes it can...
notfound.html
.htaccess
index.html
all in root (D:\WEBS\test)

access the server as normal (index.html) and type in a crap URL :(

Aussie
0
 
ahoffmannCommented:
> standard "File Not Found" error page from Firefox and IE.
what's the size of your notfound.html?
try to fill in text, let's say 500 bytes or so ...
0
 
Peter BettsRetiredAuthor Commented:
Here it is.....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
      <title></title>
</head>

<body>
Sorry, no can do


</body>
</html>
0
 
ahoffmannCommented:
please fill in more and try again
0
 
periwinkleCommented:
If the httpd.conf file has AllowOverride None, then the .htaccess file is being ignored.  You need to allow overrides in the httpd.conf.
0
 
Peter BettsRetiredAuthor Commented:
ok troops......
notfound.html now reads
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
      <title>File not Found</title>
</head>
<body>
<h2>
Sorry, no can do
</h2>
<h3>The page you are seeking has been moved <A href="Somewhere.com">Here</a>
</h3>
</body>
</html>

.htaccess
AllowOverride All
ErrorDocument 404  /notfound.html

httpd.conf
<Directory "D:/WEBS/test">
    Options Indexes FollowSymLinks +Includes
    AllowOverride None
    Order allow,deny
    Allow from all
    AddOutputFilter INCLUDES;DEFLATE shtml
</Directory>

If I change the httpd to AllowOverride All, I get
"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request"

Perhaps it IS rocket science after all.

Aussie
0
 
ahoffmannCommented:
>     AllowOverride None
is invalid in .htaccess, remove it
is wrong in httpd.conf, use
      AllowOverride All
(then if you get it wortking change All to what is sufficient for you)
0
 
Peter BettsRetiredAuthor Commented:
Thank you for that!!..

hmmm..... I perhaps should have split the points with sleep_furiously, sorry.

Aussie

0
 
Peter BettsRetiredAuthor Commented:
bugger.... I seem to have stuffed that up. Thought I entered 100pts for you and 100 for sleep *grrrrrrrrrrr*

Aussie
0
 
periwinkleCommented:
LOL, I had actually stated it first (but apparently not in a way that made it clear).  The good part is that you got it all fixed - congrats!
0
 
Chuck CobernCommented:
Your custom 404 error messege needs to be more than 512 bytes in length.  
Hint:  Use spaces.

M
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.