Apache禁止解析php 禁止指定user_agent Apache通过rewrite限制某个目录

<Directory /data/www/data> 

php_admin_flag engine off 

<filesmatch "(.*)php"> 

Order deny,allow 

Deny from all 

</filesmatch> 

</Directory>



禁止指定user_agent

<IfModule mod_rewrite.c> 

RewriteEngine on RewriteCond %{HTTP_USER_AGENT} ^*Firefox/4.0* [NC,OR] 

RewriteCond %{HTTP_USER_AGENT} ^*Tomato Bot/1.0* [NC] 

RewriteRule .* - [F] 

</IfModule>


Apache通过rewrite限制某个目录

<IfModule mod_rewrite.c> 

RewriteEngine on RewriteCond %{REQUEST_URI} ^.*/tmp/* [NC]

RewriteRule .* - [F] 

</IfModule>

你可能感兴趣的:(apache,rewrite,目录)