Deny a user by IP Address

There may come a time when you unfortunately need to ban someone from visiting your website completely.


This is very easy to do using htaccess and can be useful if there is a spammer or disgruntled member attacking your site (something which unfortunately happens a lot to forum and blog owners).

To ban someone completely all you need to do is add the following code to your .htaccess file.

Simply replace the ip address below with the ip of the person you want to ban

#ban users from visiting the site
order allow,deny
deny from 123.45.6.7
allow from all

If you want to ban more people you simply add more lines, like this :

#ban users from visiting the site
order allow,deny
deny from 123.45.6.7
deny from 987.65.4.3
deny from 56.45.34.456
allow from all

facebooktwittergoogle_plusredditpinterestlinkedinmail
facebooktwittergoogle_pluslinkedinrssyoutube