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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

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.
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 
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

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
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>
ahoffmannCommented:
> ErrorDocument 404 /notfound.html

and the file can be found in D:/WEBS/test/notfound.html ?
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
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 ...
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>
ahoffmannCommented:
please fill in more and try again
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.
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
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)
Peter BettsRetiredAuthor Commented:
Thank you for that!!..

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

Aussie

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

Aussie
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!
Chuck CobernCommented:
Your custom 404 error messege needs to be more than 512 bytes in length.  
Hint:  Use spaces.

M
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.