Block IP from accessing website using .htaccess
To block certain ip address from accessing your website, just create a file with name .htaccess at your root directory with the content below:-
order allow,deny
deny from 192.168.0.1
allow from all
If you want to block multiple ip address using .htaccess simply add one ip address per line as below:-
order allow,deny
deny from 192.168.0.2
deny from 192.168.0.3
deny from 192.168.0.4
allow from all
You can even block a network range ip using .htaccess:-
order allow,deny
deny from 129.0.0
allow from all
Note: .htaccess only works in apache webserver, if you do not know what web server you are on, your can consult with your server administrator for more details.
To block certain ip address from accessing your website, just create a file with name .htaccess at your root directory with the content below:-
order allow,deny
deny from 192.168.0.1
allow from all
If you want to block multiple ip address using .htaccess simply add one ip address per line as below:-
order allow,deny
deny from 192.168.0.2
deny from 192.168.0.3
deny from 192.168.0.4
allow from all
You can even block a network range ip using .htaccess:-
order allow,deny
deny from 129.0.0
allow from all
Note: .htaccess only works in apache webserver, if you do not know what web server you are on, your can consult with your server administrator for more details.
Thank you :)
ReplyDelete