PHP MVC项目Telegram机器人Webhook返回302 Found错误求助
Telegram Webhook返回302错误的排查求助
我有一个基于PHP的MVC站点,接收Webhook响应时,Telegram返回错误信息:Wrong response from the webhook: 302 Found。
- 已通过
https://api.telegram.org/botTOKEN/setwebhook?url=https://mysite-domain/webhook成功注册Webhook。 - SSL证书采用Let's Encrypt。
getWebhookInfo()方法执行结果
[ok] => 1 [result] => Array ( [url] => https://mysite-domain/webhook [has_custom_certificate] => [pending_update_count] => 8 [last_error_date] => 1658579570 [last_error_message] => Wrong response from the webhook: 302 Found [max_connections] => 40 [ip_address] => x.x.x.x )
我认为问题出在.htaccess配置上。根目录下的.htaccess(1)将请求重定向到/public文件夹,而/public下的.htaccess(2)将请求转发到index.php。特此求助,感谢所有提供帮助的人。
文件夹结构
- app ---controllers ---models ---views - config - public ---files ---css, js ---index.php ---.htaccess (2) - vendor - composer.json - .htaccess (1)
.htaccess (1)
AddDefaultCharset utf-8 RewriteEngine On RewriteRule (.*) public/$1
.htaccess (2)
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php?$1 [L,QSA] php_flag session.use_trans_sid Off php_flag session.use_only_cookie On php_flag session.auto_start On php_value session.gc_maxlifetime 604800 php_value session.cookie_lifetime 604800 Options -Indexes
内容的提问来源于stack exchange,提问作者Chingis Khuurak
相关产品推荐
相关产品推荐

