Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a page when I click on a link it works for me but it gets the document for my link from a directory that not everyone has permissions to see. So I can limit who sees this document. Because of limited permissions on this document the link shows an error message box saying:  "Netscape is unable to find the file or directory named //mydirectory/here/mydoc.doc." to all people who do not have permissions to view the document.

Is there anyway in perl I can do to my html so I can put my own Netscape 4.77 browser output message saying  "You do not have permissions to view this document" after someone (without proper permissions) clicks on this link???

Replies are listed 'Best First'.
Re: Changing web link output
by joe++ (Friar) on Nov 22, 2002 at 16:31 UTC
    Hi Unknown Monk,

    If I interpret your question correctly, you are looking for a way to implement file system access privileges over http.

    The classic way to do this, is by configuring the webserver to use basic authentication. You will have to provide your own user/password ist in that case.

    For the Apache webserver, the docs are here. This is further not Perl related, until you start thinking about implementing your access mechanism in Perl...

    --
    Cheers, Joe

      No, actually I just want to change the message that comes on the browser when the link is clicked to say "You do not have permissions to view this document". I thought there might be some sort of output manipulation that perl would have to do this with an output message.
        Here's how I read your question:

        You've got files in a directory protected by .htaccess

        You can access them 'cause you know the username/password

        Others who don't know the username/password can't

        If the above is true, that's 401 error, I believe.
        If I'm correct, then you can add a line to your .htaccess file:

        ErrorDocument 401 /401.html

        and place a file named 401.html in that directory that
        includes the message you'd like your not-allowed person
        to see.

        CH from NE PA