Wednesday , 25 November 2020
Stackode
Home > htaccess > Deny a user by IP Address

Deny a user by IP Address

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

About Whendy

Whendy Blog mengumpulkan beberapa Tutorial Website, PHP, AngularJS, JQuery, Laravel, Codeigniter dan lain-lain. ( jika sempat ) :)

Check Also

Htaccess Password Protect a Directory

Htaccess Password Protect a Directory is easy to do, all you have to do is ...

One comment

  1. I every time spent my half an hour to read this
    web site’s posts everyday along with a cup of coffee.

Leave a Reply

Your email address will not be published. Required fields are marked *