duncanb7
asked on
Deny IP in .htaccess
Dear expert,
I would like to deny one IP address to visit my website to read all my directoy files
I tried to use the following .htaccess file and ftp it into my public_html root directory.
========================== =======.ht access file =============
# -FrontPage-
ErrorDocument 404 /blank.html
<Limit GET POST>
order deny,allow
deny from 63.238.185.242
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
========================== ========== =
But it doesnt work any way even I reboot my VPS server.
COuld you tell how to make it success? Please advise
I am using apache Linux CentOS-64 system
Duncan
I would like to deny one IP address to visit my website to read all my directoy files
I tried to use the following .htaccess file and ftp it into my public_html root directory.
==========================
# -FrontPage-
ErrorDocument 404 /blank.html
<Limit GET POST>
order deny,allow
deny from 63.238.185.242
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
==========================
But it doesnt work any way even I reboot my VPS server.
COuld you tell how to make it success? Please advise
I am using apache Linux CentOS-64 system
Duncan
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
If you're trying to block someone who is trying to "attack" your site, you might want to consider using iptables to block the IP completely at the firewall level. That way you can easily block that IP (or more later) from everything, including FTP, mail, web, etc... It will be far more effective than .htaccess (and you can set up additional protection for yourself).
ASKER
Yes, it is simple logic, thanks
Here's a template for the iptables rules. Basically, you will need to modify the parts about the IP addresses to include your IP address and the IP addresses you want to block. Then you load it with iptables-restore < file_containing_the_final_ rules.txt
iptables-template.txt
iptables-template.txt
So did you use htaccess or did you use iptables?
ASKER
use .htaccess
ASKER
For memo only:
========================
what is different bettween httpd.conf and .htaccess
http://www.webmasterworld.com/forum92/513.htm
========================
what is different bettween httpd.conf and .htaccess
http://www.webmasterworld.com/forum92/513.htm
ASKER