Jump to content

Ban IP address from viewing site


Square Wheels

Recommended Posts

Posted
13 minutes ago, Square Wheels said:

Can I ban IP addresses from viewing the site?

Add to your htaccess file

deny from xxx.xxx.xxx.xxx

xxx -> IP address

Posted

To clarify, you can add that as a block in an .htaccess file, as was noted. The full block of code to add would be:

order allow,deny
deny from xxx.xxx.xxx.xxx
allow from all

where xxx.xxx.xxx.xxx is the actual IP Address you want to block. Additional "deny from" lines can be added after the first one, but before the last line, as so:

order allow,deny
deny from xxx.xxx.xxx.xxx
deny from xxx.xxx.xxx.xxx
deny from xxx.xxx.xxx.xxx
allow from all

The exact message they will see depends somewhat on the server, but generally they will get a "You don't have permission to access / on this server" or similar wording.

Posted

If your on a VPS / Dedi and have root access and csf firewall then in ssh type

csf -d [xxx.xxx.xxx.xxx] [reason text]	

Example to add IP to /etc/csf/csf.deny	

root@onrahost[~]#csf -d 122.34.5.66 Reason for block

You will then need to restart CSF to make the changes take effect

csf -r

Example to restart csf	

root@onrahost[~]#csf -r

 

Posted

Thanks all.

Not sure if I will be doing this yet.  It's actually for one of my best members.  He feels he needs an electronic vacation so I banned him from the site (per request), but he still visits the site and emails some of his friends.  Before I offered to him the ability to completely ban him, I wanted to see if it could be done.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...