On apache how do I allow access to only to a single file?

Posted by sriram on Server Fault See other posts from Server Fault or by sriram
Published on 2012-12-10T11:39:48Z Indexed on 2012/12/11 11:05 UTC
Read the original article Hit count: 217

Filed under:

I have a apache machine which is serving a .js file. That file should be the only file that need to seen.

I have configured to do so in my apache like this :

<Location /var/www/test/test.js>
    Order allow,deny
    Allow from all
</Location>

The site address is test.in which points to test.js file in /var/www/test directory. That is working fine. But I wish when the user tries to hit test.in/someurl (which is not available) or some other url than test.in need to give an message with 401 error.

How do I do that?

© Server Fault or respective owner

Related posts about apache2