【问题标题】:Why can i download a file that it secured with htaccess file ?为什么我可以下载使用 htaccess 文件保护的文件?
【发布时间】:2012-04-05 06:59:10
【问题描述】:

这是 htaccess 文件:

ErrorDocument 400 /index.php
   ErrorDocument 401 /index.php
   ErrorDocument 403 /index.php
   ErrorDocument 404 /index.php
   ErrorDocument 405 /index.php

   <Files configure.php>
      order allow,deny
      deny from all
   </Files>

configure.php 文件在某个文件夹中,比如说 /config/configure.php 现在的问题是我可以下载它!只需建立一个链接即可。 正是因为这一行 ErrorDocument 404 /index.php,当我删除这一行时,我 收到 404 错误,无法下载 configure.php 文件。但是为什么会这样 这一行(我想要的)可以下载 configure.php 文件?

【问题讨论】:

  • 你的裹尸布应该是.htaccess 而不是htaccess .... 在本地测试过,效果很好...

标签: php apache .htaccess xampp


【解决方案1】:

您需要将.htaccess 文件( htaccess 没有前导点)放入configure.php 所在的文件夹(至少)以使&lt;Files configure.php&gt;-directiveDocs 工作。另见Filesystem, Webspace, and Boolean ExpressionsDocs

相关:Requests to .htaccess should return 404 instead of 403

【讨论】:

    猜你喜欢
    • 2020-08-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-02
    • 1970-01-01
    • 2010-10-12
    • 1970-01-01
    相关资源
    最近更新 更多