日期:2014-05-17  浏览次数:20431 次

.htaccess问题
<Files ~ "^.*\.(php|cgi|pl|php3|php4|php5|php6|phtml|inc|jsp|py|sql)">
  Order allow,deny
  Deny from all
</Files>

这个是可以禁止php等文件执行

如何把它改成只能执行jpg,gif,png呢?


如何设置只能访问某个目录的文件?

------解决方案--------------------
<Files ~ "^.*\.(jpg|gif|png)">
Order allow,deny
Deny from all
</Files>

只能访问某个目录的文件 是什么意思?

apache 只能打开某个目录?
------解决方案--------------------
楼上正解
------解决方案--------------------
<Files ~ "^.*\.(php|cgi|pl|php3|php4|php5|php6|phtml|inc|jsp|py|sql)">
Order allow,deny
Deny from all
</Files>
<Files ~ "^.*\.(jpg|gif|png)">
Order allow,deny
allow from all
</Files>
这样写两个就可以了。
如果解决了,帮忙点一下这个网站的广告:http://blog.72-web.com
谢谢
------解决方案--------------------
PHP code
<FilesMatch “.(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$”> 
Header set Cache-Control “max-age=2592000″ 
</FilesMatch>

------解决方案--------------------
去掉"^"