RewriteEngine On

# Redirect .php URLs to extensionless URLs — GET/HEAD only.
# POST must never be redirected here: a 301/302 causes browsers and
# fetch() to drop the request body and downgrade the method to GET,
# which silently breaks any form posting to "whatsapp_settings.php"
# (or any AJAX call to "status.php", "whatsapp_send.php", etc.) by
# turning it into a bodyless GET before the .php file ever runs.
RewriteCond %{REQUEST_METHOD} ^(GET|HEAD)$
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC]
RewriteRule ^(.+)\.php$ /$1 [R=301,L]

# Internally rewrite extensionless URLs to .php
# (Internal [L] rewrite, not a redirect — method and body are preserved
# regardless, so this rule doesn't need the GET/HEAD restriction.)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/.]+)$ $1.php [L]

# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php8_module>
   php_flag display_errors On
   php_value max_execution_time 30
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 128M
   php_value post_max_size 100M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php82"
   php_value upload_max_filesize 50M
   php_flag zlib.output_compression Off
   php_value auto_prepend_file "auth_guard.php"
</IfModule>
<IfModule lsapi_module>
   php_flag display_errors On
   php_value max_execution_time 30
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 128M
   php_value post_max_size 100M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php82"
   php_value upload_max_filesize 50M
   php_flag zlib.output_compression Off
   php_value auto_prepend_file "auth_guard.php"
</IfModule>
# END cPanel-generated php ini directives, do not edit

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php82” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php82 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
