htaccess IP blocking with custom 403 Error not working

Posted by mrc0der on Server Fault See other posts from Server Fault or by mrc0der
Published on 2012-10-18T12:57:41Z Indexed on 2012/10/30 23:05 UTC
Read the original article Hit count: 283

Filed under:
|

I'm trying to block everyone but 1 IP address from my site on a server running apache & centos. My setup is follows the example below.

My server:

`http://www.myserver.com/`

My .htaccess file

<limit GET> 
order deny,allow  
deny from all  
allow from 176.219.192.141
</limit>

ErrorDocument 403 http://www.google.com
ErrorDocument 404 http://www.google.com

When I visit http://www.myserver.com/ from an invalid IP, it gives me a generic 403 error. When I visit http://www.myserver.com/page-does-not-exist/ it redirects me correctly to http://www.google.com but I can't figure out why the 403 error doesn't redirect me too. Anyone have any ideas?

© Server Fault or respective owner

Related posts about apache2

Related posts about .htaccess