Apr
13
Block IPs Using htaccess
April 13, 2008 |
How do I block certain IPs from accessing my site or directory? It’s pretty easy! All you have to do is create an .htaccess file in the directory you’d like to restrict (your main directory to restrict the entire site) and then put the following in it:
order allow,deny
allow from all
deny from 123.142.124.152
deny from 124.24.
You can put whole ips or just the beginning part you’d like to match, and you can add more and more ips, each with its own line!
When somebody’s ip is banned, they will get a 403 error (access forbidden) when trying to visit your site.
Similar Posts
- Block people from Certain URL Using htaccess
- Deny Access to inc Files Using htaccess
- Use htaccess to Deny Access Directory Listing
- htaccess Deny Diractory Access During a Specific Time
- Create Custom Error Pages Using htaccess PHP
- Use htaccess to Deny Access to hidden Files
- htaccess Remove the www From Domain URL
- htaccess Explicitly Define Default Index File
- htaccess Permanently redirect file or directory
- htaccess Require the www For Domain URL
- Use htaccess with Site Maintenance Page
- htaccess Limit the Number of Concurrent Visitors to your Website
- Useful mod_rewrite Resources
- Google Text Translation Using htaccess
- Apache htaccess Prevent Users from Uploading and Executing Files
- Use htaccess for 404 Redirect
- Set Local Timezone Using htaccess
- Remove File Extension Using htaccess
- htaccess Conditional Loop Redirect
- Force Files Like PDF Download using htaccess
- Use htaccess to Fake Different File Extension
- htaccess gzip for Faster Loading and Bandwidth Saving
Comments
1 Comment so far



































[...] actually very similar to blocking people by IP! Again, you need to add some lines to an .htaccess text file that you create in the home directory [...]