I was skimming through my Apache Error Log today (as one does of a Saturday evening) and was finding a load of entries with.

[notice] cannot use a full URL in a 401 ErrorDocument directive --- ignoring

Naturally you want to fix anything in your error log so I went looking for a solution.

In my case it turns out what was happening was in one of my .htaccess files I was giving a complete URL as the path to error documents, the fix was to change it to a relative path.

Which basically means I had something like;

ErrorDocument 401 http://mysite.com/errorpage.html

And I had to change it to

ErrorDocument 401 /errorpage.html

Unfortunately it doesn't tell you much about the location of your .htaccess file and if you have several sites on a server hunting it down could be a bummer.  I would suggest using find and grep commands to help narrow down your list of possibilities. I did something like this;

find -name '.htaccess' -exec grep ErrorDocument {} \; -print

From inside the home directory and it returned all the .htaccess files with reference to ErrorDocument.

A very quick fix but one that will keep my Error Log all the cleaner!

Why not read some more of our Web Dev posts?