I am setting up this 401 page on my Ubuntu Server 7.04 with LAMP.
First off, create a simple html page which I named 401.html. Place the 401.html under your root folder (default root is /var/www/apache2-default/). Now to redirect the users to your newly created 401 page instead of the default 401. Edit the apache2.conf.
Sudo gedit /etc/apache2/apache2.conf
Find the following line:
# Some Examples:
#ErrorDocument 500 “The server made a boo boo.”
#ErrorDocument 401 /401.html
#ErrorDocument 404 “/cgi-bin/missing_handler.pl”
#ErrorDocument 402 http://www.example.com/subscription_info.html
As you can see, take the # off and link it to your 401.html file.
Restart apache and your are good to go.
sudo /etc/init.d/apache2 restart