Apache - [notice] cannot use a full URL in a 401

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

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.

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!

Recent posts View all

VS CodeWeb Dev

Select multiple lines in VS Code

How to select multiple lines to edit at once within VS Code

VS Code Web Dev

Move a line up or down with VS Code

A quick tip on moving lines up or down a file using your keyboard in VS Code