如何防止apache重定向到php.index

时间:2016-03-20 09:25:32

标签: php apache curl wget

我使用php脚本发送短信。 我已经将服务从CentOS 5迁移到CentOS 7,现在我在尝试访问example.com/sms/smsreceive.php时遇到了问题。 Apache为index.php重定向。我怎么能阻止它?它似乎只发生在curl或wget上。对于从浏览器启动的请求,它工作正常。 我只是假设它与HTTP版本有关。 我使用CentOS7,php-5.4.16,Apache 2.4.6 在旧的Apache 2.2上,问题不存在。

正确回复(来自浏览器) - apache access.log:

10.0.0.2 - - [20/Mar/2016:09:08:49 +0100] "GET /sms/smsreceive.php HTTP/1.1" 200 883

错误回复(来自wget或curl) - apache access.log:

10.0.0.3 - - [20/Mar/2016:09:08:23 +0100] "GET /sms/smsreceive.php HTTP/1.0" 302 -

这是我在尝试从wget获得它时所得到的:

wget --delete-after http://host.example.com/sms/smsreceive.php
--2016-03-20 10:28:11--  http://host.example.com/sms/smsreceive.php
Resolving host.example.com... 1.2.3.4
Connecting to host.example.com|1.2.3.4|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: index.php [following]
--2016-03-20 10:28:11--  http://host.example.com/sms/index.php
Reusing existing connection to host.example.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 1501 (1.5K) [text/html]
Saving to: `index.php'

但是当我请求info.php时,没有重定向就可以正常工作:

wget --delete-after http://host.example.com/sms/info.php
--2016-03-20 10:50:12--  http://host.example.com/sms/info.php
Resolving host.example.com... 1.2.3.4
Connecting to host.example.com|1.2.3.4|:80... connected.
HTTP request sent, awaiting respon## Heading ##se... 200 OK
Length: unspecified [text/html]
Saving to: `info.php'

什么可能导致302重定向,以及如何防止Apache重定向所有请求?

现在,脚本对尝试使用它的linux服务器不起作用。

非常感谢您的帮助!

0 个答案:

没有答案