My Twitter

Blocking users via .htaccess

January 28th, 2009

Every website has problems with users . Here is a cool way to ban users who prove to be annoying.

Open your .htaccess file (should be above your public_html folder and you may need to show hidden files), then add the following:

order allow,deny
deny from [IP here]
allow from all

If you want to add more than one IP, just add an extra “deny from [ip here]” line. On the other hand, if you want to just let one person onto a website just use the following:

order allow,deny
allow from [IP here]
deny from all

Allowing just a few IP’s to certain areas is useful when protecting administrator sections or user areas.

Design BumpRSS FeedTwitter

Leave a Reply