Htaccess


#1

I’ve done the usual
put an htaccess file in the top level ErrorDocument 404 /404.shtml
the 404.shtml file is in the same directory and I get an error
The requested URL /statr.html was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

ps just put a non existent address in to bring up the 404
Can anyone help
Thanks
Bill


#2

Does the shtml work when you browse to it directly?


#3

Hi
Yes if I browse to it directly it works.
If I type an incorrect name it does not.
Thanks
Bill


#4

Put 404.shtml in the domain root or change the directive to a place where your error documents are.

example:

ErrorDocument 404 /errordocs/404.shtml
ErrorDocument 500 /errordocs/500.shtml

#5

The 404 is in the root,
as is the .htaccess.

This works by browsing http://www.craftsburypubliclibrary.org/404.shtml
The proper page comes up,
but if an error is typed
This http://www.craftsburypubliclibrary.org/wrong.html
gets this:
The requested URL /wrong.html was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Thanks!
Bill


#6

Wait a minute… your ErrorDocument directive is pointed to /errordocs/404.shtml, but there’s nothing there. The actual error page is at /404.shtml (at the root of your web site, not in the /errordocs/ directory).

Therefore:

Does that part of the error message suddenly make a lot more sense now? :slight_smile:


#7

Ok, how do I change that directive to look in the root for .htaccess ?
Thanks!
Bill


#8

Remove the erroneous /errordocs/ bit and point to where the error page actually exists:


#9

That’s what he had at the start. (there was an or clause in the example he quoted).

Sounds like something is wrong with the .htaccess file itself. Does it contain any other directives? Do they function? Does it have a preceding .dot? Check the spelling.


#10

You are right, the . was missing, although I had added it, I had to rename
it on the server as windows didn’t like it and changed it before I transferred it.
Many Thanks Guys!
Bill