Web Hosting Talk







View Full Version : Limit File Access via IP ???


PCplayground
04-16-2004, 10:06 AM
Hello,

I was reading a security article that mentioned that you can block file/directory access on apache and set it to allow only certain IPs access it.

I wish to do this, however I have not been able to find the data I seek via google.

I wish to limit "admin.php" to my IP block and the IP block of another admin.

Is this possible? Could anyone provide some assistance?

Thank you in advance.

Mdot
04-16-2004, 11:10 PM
this can be done in ".htaccess". Here's an example - allow access to "/admin.php" from "1.1.1.1" and deny everyone else:


<Location /admin.php>
Order deny,allow
Deny from all
Allow from 1.1.1.1
</Location>


this should be uploaded in your site's root directory as ".htaccess"

regards,
M.

PCplayground
04-17-2004, 12:01 AM
Originally posted by Miha
this can be done in ".htaccess". Here's an example - allow access to "/admin.php" from "1.1.1.1" and deny everyone else:


<Location /admin.php>
Order deny,allow
Deny from all
Allow from 1.1.1.1
</Location>


this should be uploaded in your site's root directory as ".htaccess"

regards,
M.

Thank you very much for your reply.

To allow two different IP blocks would I then have this:


<Location /admin.php>
Order deny,allow
Deny from all
Allow from 1.1.1.1, 2.2.2.2
</Location>


Notice the comma.

Also, would you happen to know if for an IP block what character I use? IE: 1.1.*.*

Once again, thank you in advance.

Mdot
04-17-2004, 12:10 AM
Originally posted by PCplayground

Also, would you happen to know if for an IP block what character I use? IE: 1.1.*.*


just put "1.1", which translates to "1.1.*.*"

regards,
M.

Mdot
04-17-2004, 12:15 AM
forgot about comma - no comma (space only). just like this: "1.2.3.4 1.2.35.32 23.52.9" etc

regards,
M.

PCplayground
04-17-2004, 11:49 AM
Awesome, thank you very very much. :D

:beer: