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

# ✅ Enable URL rewriting
RewriteEngine On
RewriteBase /

# ✅ Remove .html and .php extensions (clean URLs)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^([^/]+)$ $1.html [NC,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)$ $1.php [NC,L]

# ✅ If file or directory does not exist, show 404.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /404.html [L]

# ✅ Custom 404 page
ErrorDocument 404 /404.html

# 🚫 Block access to xmlrpc.php
<Files "xmlrpc.php">
    Require all denied
</Files>

# 🚫 Block access to wp-cron.php
<Files "wp-cron.php">
    Require all denied
</Files>

# 🚫 Block access to .env and sensitive files
<FilesMatch "^(\.env|\.git|composer\.json|composer\.lock|package\.json|webpack\.config\.js)$">
    Require all denied
</FilesMatch>

# ✅ Set default main page to app.php
DirectoryIndex app.php
