To block certain ip address from accessing your website, just create a file with name .htaccess at your root directory with the content below:-
order allow,deny deny from 192.168.0.1 allow from all
If you want to block multiple ip address using .htaccess simply add one ip address per line as below:-
order allow,deny deny from 192.168.0.2 deny from 192.168.0.3 deny from 192.168.0.4 allow from all
You can even block a network range ip using .htaccess:-
order allow,deny deny from 129.0.0 allow from all
Note: .htaccess only works in apache webserver, if you do not know what web server you are on, your can consult with your server administrator for more details.
[tags]block ip, block access, block access to website, apache, .htaccess block ip, .htaccess block ip range, .htaccess block access, apache .htaccess, .htaccess[/tags]
How to remove Powered By Prestashop footer link
Redirect to maintenance page during upgrade using .htaccess
How to disable directory browsing using .htaccess - Apache Web Server
How to convert Youtube video to IPod / IPhone (mp4)
Domain Parking - How to park a domain in CPanel Hosting
How to remove apache test page in CentOS
How to block customer from accessing WP Admin in WordPress
Prestashop: How to disable ajax add to cart?
Share this with your friends:-
This was a huge help! Thank you for posting the instructions. Seems to solve my issue of several from another country trying to get in.
Really suspicious when you see 4 ips at the same time from another country all hitting the same page at the exact same time.
I would like to know if it’s possible to block an IP the way that the visitor just receives a “The page is inaccessible” error (like error 101 ERR_CONNECTION_RESET in Chrome), and couldn’t even receive a response when pinging a server? Is it possible?
I ask this because I can’t access the website and can’t understand if I was blocked or having a DNS problem. I accessed it this morning easily, but not now. I don’t even receive response when pinging. Is it possible that they have blocked my IP address?
Thanks now I can block an IP which always trying to access my wp dashboard
Jeremy, did you ever get a fix/answer to this?
hi kathy, your problem is a very common problem.
here’s the workaround:-
create a text file with the name of htaccess.dot
then u upload to your server and rename it to .htaccess at the server using FTP software or in the control panel (like: Cpanel, DirectAdmin, etc).
I am using FrontPage and a template, but can’t make a file on the website because of the period in front, I know it may be a dumb thing but I am a novice and just don’t want to mess anything up, anymore that is.
First, you must fix your mistake in the last example: It should be: 192.0.0.0 NOT: 129.0.0
192.0.0.0/8 blocks that whole range of ip’s from this first number range TO: 188.8.131.52
This mostly blocks the city in that state range of ip’s
How can you multiple block ips from accessing just 1 page from your htaccess? and allow access to everything else? we have a classifieds site, just want to allow everyone to view the site, but block the spammers by their ips from trying to post on our site.. Thanks a bunch!
Beethink ip blocker bans country ips with .htaccess file for my windows 2008 servers.
if u cant access your website, that may caused by many things.
try to ping your domain if there is any reply and check if the ip is the same as your website ip.
may times is caused by the DNS propagation problem.
or u can try to flush your dns.
I have had the SAME issue happen. My hoster says there is nothing in the htaccess but I cannot access any of my sites at all. Others can and I can if I hide my ip as well. I really need to know Daniel what you did about this. I was also hacked in January so if this is some type of malicious attack I need to know how its being done – please connect with me.
at the document root path. If u r using CPanel, here’s the patch to your .htaccess
Where can I create the .htaccess file? in which path?
You should have emails with contact phone numbers from Lunar pages. If this is true, you should be able to call them, provide something like a billing credit card number, and then have them manually check your .htaccess files for any sign of IP additions like above.
Also, you are POSITIVE it’s an IP attack like that? For example, you can access your sites from any other location except for your own home? Also: you’re receiving a static IP from your provider, and not a dynamic one? It just seems like a really weird issue.
Daniel, did you ever get a fix/answer to this? Good luck.
Hi, please help someone.
Somehow, someone has manually blocked my IP address (mine only) from accessing all of my personal websites. This is most probably a personal attack and I know who did it too. They have done this from the other side of the world.
They even blocked my ip from accessing lunarpages which is the people he knew I would go to for help.
PLEASE can someone tell me:
1) How did they do it without having access to my ftp logins or my office/computers?
2) How do I undo it
FYI, I can access my sites when I hide my IP address and No one has touched my computers settings.
Please tell me what this problem is and how to fix it. Big respect to anyone who can solve this riddle.
Is there a way to block just specific URLs from an IP range, something like the RewriteRule 301 statements?
It would be something like:
for the following URLs/regular expressions
deny access to this IP range
[…] å‚è€ƒç½‘å€ï¼š http://www.techiecorner.com/95/block-ip-from-accessing-website-using-htaccess/ […]
You can also ban everyone except for your home IP address like so:
allow from YOURIPADDRESSHERE
deny from all
Another kind of cool thing to do is block say the whole 8 bit like
deny from 184.108.40.206/8
Which would block all 220.127.116.11 thru 18.104.22.168 all in one pop. Sometimes this is too much, but it is handy for blocking entire countries or areas on occassion.
Then if there was one like 22.214.171.124 you wanted to allow:
deny from 126.96.36.199/8
allow from 188.8.131.52
Sometimes it’s easier to deny a whole bunch and allow only a few than to type a couple hundred (one per line).