Block IP addresses Using .HTACCESS
Hello Friends !!
In my previous post, i was write how to block IP address using PHP script ?
Today i will write that how to block IP address using .HTACCESS ?
There are several ways to block a specific IP range.
The first utilizes a CIDR number to block the specified range (via htaccess):
<Limit GET POST PUT>
order allow,deny
allow from all
deny from 214.53.25.64/26
</Limit>
The second method is similar, only here we are expressing the range in netmask notation, using corresponding network/netmask values:
<Limit GET POST PUT>
order allow,deny
allow from all
deny from 214.53.25.64/255.255.255.192
</Limit>
The third method tests all IP addresses against a predefined regular expression via RewriteCond/RewriteRule directives:
RewriteCond %{REMOTE_ADDR} ^214\.53\.25\.(6[4-9]|7[0-9]|8[0-9]|9[0-9])$ [OR]
RewriteCond %{REMOTE_ADDR} ^214\.53\.25\.1([0-1][0-9]|2[0-8])$
RewriteRule .* – [F]
Here is a way of blocking a specific ISP via its IP address(es).
Order Allow,Deny
Allow from all
Deny from 123.123.123.
Deny from 456.456.456.
</Files>
There is probably a more efficient way to write the regular expressions in the previous example, but that should definitely get the job done.
I think this post become useful to you.
-
http://www.mavenmullet.com/ srganesan
-
http://www.mavenmullet.com srganesan
-
http://JoshuaXiong.Webs.Com/ JoshuaXiong
-
http://JoshuaXiong.Webs.Com JoshuaXiong
-
http://www.jaceju.net/blog/?p=410 網站製作學習誌 » [Web] 連結分享
-
http://tagz.in/posts/7cw/comments/ Tagz | "Block IP addresses Using .HTACCESS | php genious" | Comments
-
GarrySch
-
GarrySch
-
Guest
-
phpgenious




