Good day! I have an MVC site in PHP. The essence of the problem is that when receiving a webhook response, Telegram sends an error message - Wrong response from the webhook: 302 Found.
- The webhook was successfully registered using the link https://api.telegram.org/botTOKEN/setwebhook?url=https://mysite-domain/webhook.
- SSL: certificate Let's Encrypt.
Result of getWebhookInfo() method
[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
)
I think the problem is in .htaccess. The root folder has .htaccess (1) and requests are redirected to the /public folder. And in .htaccess(2), requests are sent to index.php. Learning. Thanks in advance to all those who help in solving this problem.
Folder structure:
- 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