duandan9680
2017-01-14 09:06
浏览 116
已采纳

仅允许通过代码使用.htaccess访问文件夹

I want to hide my uploads folder but i want to access it via php . Is this possible with .htaccess ? I tried something but didn't worked.

    <files "/uploads">
  order allow,deny
  deny from all
    </files>

    <folders uploads>
Order Allow,Deny
Deny from all
    </folders>

图片转代码服务由CSDN问答提供 功能建议

我想隐藏我的 uploads 文件夹,但我想通过php访问它。 是否可以使用 .htaccess ? 我尝试了一些但没有用的。

 &lt; files“/ uploads”&gt; 
 order allow,deny 
 deny from all 
&lt; / files&gt; 
 
&lt; folders uploads&gt;  
订单允许,拒绝
Deny来自所有
&lt; / folders&gt; 
   
 
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • drgmszo076956 2017-01-14 09:19
    已采纳

    You're almost there, but it depends on what version of Apache you're using also.

    The above method you're trying is if you want to block access to a specific file, if you want to block a folder, then add your .htaccess file to that folder and just use:

    Below 2.4:

    deny from all
    

    2.4 or above:

    Require all denied
    
    评论
    解决 无用
    打赏 举报
  • 查看更多回答(1条)

相关推荐 更多相似问题