Forum Moderators: coopster

Message Too Old, No Replies

Allow access from just one IP

         

Awful newbie

8:13 pm on Jun 14, 2007 (gmt 0)

10+ Year Member



Do I need PHP in order to allow access to one certain file from just ONE IP? Or is it possible to solve this with a .htaccess file?

phparion

6:01 am on Jun 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



can be done with both IF you have a PHP page called before accessing the file then can be done with PHP otherwise with htaccess and if the user directly browser a folder to get the file then htaccess is the solution.

however I would recommend htaccess as you can define a range of IPs that is to define a country rather than just one IP address because if the IPs are dynamic, unless your allowed user has static IP, and they change on every visit.

Awful newbie

7:13 am on Jun 15, 2007 (gmt 0)

10+ Year Member



So the simplest and most secure way is just like this?:

AuthName "Protected"
AuthType Basic
<Limit GET POST>
order deny,allow
deny from all
allow from 100.100.100.
</Limit>

phparion

7:27 am on Jun 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



yes it should work!

Awful newbie

8:27 am on Jun 15, 2007 (gmt 0)

10+ Year Member



Thanks, it works!

Its really hard to imagine that some times the best solution is the simplest solution.