I have a script for me to browse the source code of my projects. I wrote the script in PHP so that I can have authentication working. I got the authentication part working. Very simple. However in my /var/www/htdocs/foo/

I have foo.pl that I only want to be accessed if I logged in (authentication). But how do I make sure that if I type in the path to that file, it displays an error to log in rather than show the file ?

I only want clients to see foo.pl if they have authentication.

How can I do that?

I would've searched google but I don't know how to search for this information.

Any helps/hints are appreciated.