I have a file on my apache server which i do not want the public to access.

I have a couple of IP addresses that will be needing the file, hence i want to grant them access to the file.

How can i go about it?

Thanks

link|improve this question
feedback

migrated from stackoverflow.com Jun 23 '11 at 6:29

This question came from our site for professional and enthusiast programmers.

2 Answers

If you want to restrict access to just a single file say /var/www/filename.ext:

<Directory /var/www/>
  <Files filename.ext>
    Order allow,deny
    Allow from 192.168.1.1 192.168.10.12 192.168.1.15
  </Files>
</Directory> 
link|improve this answer
feedback

mod_authz_host? There are a few way to specify, check out the link it has a few examples.

Order Deny,Allow
Deny from all
Allow from 10.1.2.3
Allow from 192.168.1.104 192.168.1.205 
link|improve this answer
feedback

Your Answer

 
or
required, but never shown