how to restrict access to all .txt file in apache except robots.txt?

Posted by user3162764 on Server Fault See other posts from Server Fault or by user3162764
Published on 2014-08-19T04:19:55Z Indexed on 2014/08/19 4:22 UTC
Read the original article Hit count: 406

Filed under:
|

I am configuring apache2 on debian and would like to allow only robots.txt to be accessed for searching engines, while other .txt files are restricted, I tried to add the followings to .htaccess but no luck:

<Files robots.txt>
Order Allow,Deny
Allow from All
</Files>

<Files *.txt>
Order Deny,Allow
Deny from All
</Files>

Can anyone help or give me some hints? I am new comer to apache, thanks a lot.

© Server Fault or respective owner

Related posts about apache-2.2

Related posts about debian-squeeze