101TECH

IT Solutions Done Right!

control ip access to apache via .htaccess

Posted on | July 6, 2009 | No Comments

1. Allow only specific ip address :

order allow,deny
deny from all
allow from 192.168.1.1
allow from 192.168.1.2

2. Block specific ip address :

order deny,allow
allow from all
deny from 192.168.1.1
deny from 192.168.1.2

you can substitute ip for :

subnet -> deny from 192.168.1.0/24
subnet wild cards -> deny from 192.168.*.*
domain -> deny from domain\.com

you can also combine ip’s on one line:

deny from 192.168.1.1 192.168.2.1

Comments

Leave a Reply





About

This is an area on your website where you can add text. This will serve as an informative location on your website, where you can talk about your site.

Subscribe to our feed

Search

Admin