Apache: how to limit virtual dir to local network

user86282 picture user86282 · Apr 2, 2009 · Viewed 7.5k times · Source

On my Apache 2.x server at home, I have a number of virtual directories. I've set up my router so that I can access Apache from the internet. I need to keep one of those virtual dirs (/private) from being accessed outside my home network LAN. So given /private, how do I configure Apache to only serve requests to /private from 192.168.4.x?

Answer

chaos picture chaos · Apr 2, 2009
<Directory /users/me/private>
    Order deny,allow
    Allow from 192.168.4
    Deny from all
</Directory>