Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to deny all ip addresses but allow one specific ip address in .htaccess. Can someone tell me how I should configure my .htaccess or is it a different file? I have CentOS 5 and Apache.

share|improve this question
add comment

1 Answer 1

<Directory /directory_name>
    Order Deny,Allow
    Deny from all
    Allow from 1.2.3.4
</Directory>
share|improve this answer
2  
Small note: This won't work in an .htaccess file but only in the main Apache httpd configuration. If you want to use the snipper in an .htaccess file you'll have to drop the <Directory> tags. –  joschi May 4 '11 at 19:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.