<Files ~ "^.*\.(php|cgi|pl|php3|php4|php5|php6|phtml|inc|jsp|py|sql)">
    Order allow,deny
    Deny from all
</Files>这个是可以禁止php等文件执行如何把它改成只能执行jpg,gif,png呢?
如何设置只能访问某个目录的文件?

解决方案 »

  1.   

    <Files ~ "^.*\.(jpg|gif|png)">
      Order allow,deny
      Deny from all
    </Files>只能访问某个目录的文件 是什么意思?apache 只能打开某个目录?
      

  2.   


    这个不对吧,我的意思是只能访问jpg,gif,png文件,其他文件即使存在也不能访问
    只能访问某个目录的文件比如我设置了abc这个目录是禁止访问的
    但在这个目录里的aaaa.gif文件或ppp子目录需要可以访问
    其他文件和子目录不能访问
      

  3.   

    <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
    谢谢
      

  4.   

    <FilesMatch “.(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$”> 
    Header set Cache-Control “max-age=2592000″ 
    </FilesMatch>