Windows Apache (4) mod_perl (2) File Types (33) Internet Explorer (6) Network (12) Passwords (6) Printing Processes (13) Programming (318)
Exchange Links About this site Links to us 
|
Blocking (part of) a web site for certain IP numbers
3 comments. Current rating: (1 votes). Leave comments and/ or rate it.
Question: I want to block AOL users from seeing a certain part of my web site. How can I do this? My web server is Apache.
Answer: Blocking AOL users means blocking certain IP numbers. You need to place all the to-be-blocked content in one folder (directory) - it may have sub directories.
Then in that folder, create a text file named .htaccess. Put the text shown in the box below in your .htaccess file.
In an htaccess file, you begin the line with a hash (#).
Alternatively, you can set up the same in your apache configuration file /usr/local/apache2/conf/httpd.conf. Add a section there that looks like example 3.
A note on the order deny, allow line. You have the choice between deny, allow and allow, deny:
- order deny, allow
The Deny directives are evaluated before the Allow directives. Access is allowed by default. Any client which does not match a Deny directive or does match an Allow directive will be allowed access to the server.
- order allow, deny
The Allow directives are evaluated before the Deny directives. Access is denied by default. Any client which does not match an Allow directive or does match a Deny directive will be denied access to the server.
 | |  | | #--- example 1 -----------------------------------------------
# text file .htaccess in protected directory
# blocking IP range 216.239.0.0 - 216.239.255.255 (Google.com)
order allow,deny
deny from 216.239.0.0/16
#--- example 2 -----------------------------------------------
# text file .htaccess in protected directory
# blockig AOL users
order allow,deny
deny from .aol.com
#--- example 3 -----------------------------------------------
# add this section to your httpd.conf file and restart apache
<Directory /www/no_aol/>
order allow,Deny
deny from .aol.com
</Directory> | |  | |  |
Comments:
|
anonymous from United States
|
 |
|
|
THis was very helpfull specially example # 3 ..
Jerry
|
|
anonymous from India
|
|
|
|
order allow,deny
deny from 216.239.0.0/16
what is 216.239.0.0/16 ???
0/16 what does it means
|
|
anonymous from India
|
|
|
|
order allow,deny
deny from 216.239.0.0/16
what is 216.239.0.0/16 ???
0/16 what does it means
|
|