【问题标题】:Using htaccess deny causes error with PHP getimagesize使用 htaccess 拒绝会导致 PHP getimagesize 出错
【发布时间】:2014-07-08 19:09:12
【问题描述】:

我的 htaccess 文件中有以下内容,以防止访问我们网络之外的网站:

<Limit GET POST PUT>
 order deny,allow
 deny from all
 allow from xx.xxx.xxx.xx
</Limit>

但这会导致以下错误:

Warning: getimagesize(http://domain.com/wp-content/uploads/2014/07/nalogo.png) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /html/wp-content/themes/test/framework/styles.php on line 60

关于如何解决此问题的任何想法? 如果我禁用 htaccess 拒绝,这将有效。

【问题讨论】:

  • 没有 htaccess 指令,它可以工作吗?
  • 是的,如果我的问题不清楚,对不起。
  • 你试过getimagesize('local/path/to/uploads.../nalogo.png')吗?
  • limit 中删除GET 使其成为&lt;Limit POST PUT&gt;
  • 我需要拒绝 GET,因为我不希望任何人访问网络之外的网站。基本上我需要允许 PHP 访问事物但不允许用户访问...

标签: php .htaccess


【解决方案1】:

尝试在允许列表中添加 localhost:

<Limit GET POST PUT>
 order deny,allow
 deny from all
 allow from xx.xxx.xxx.xx
 allow from 127.0.0.1
</Limit>

【讨论】:

    猜你喜欢
    • 2012-10-28
    • 2011-08-21
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 1970-01-01
    • 1970-01-01
    • 2017-06-16
    相关资源
    最近更新 更多