RewriteEngine On

RewriteOptions inherit

# ========================================================
# Redirect root domain to /wp/ (your original rule)
# ========================================================
RewriteCond %{HTTP_HOST} ^bravems\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.bravems\.com$
RewriteRule ^/?$ https://bravems.com/wp/ [R=301,L]


# ========================================================
# MAINTENANCE MODE WITH ADMIN & IP BYPASS
# ========================================================

# Your IP bypass (replace with your real IP)
SetEnvIf Remote_Addr "^137.59.146.110$" adminip

# Allow admin pages + login + AJAX + cron + your IP
RewriteCond %{REQUEST_URI} ^/wp/wp-admin [OR]
RewriteCond %{REQUEST_URI} ^/wp/wp-login\.php [OR]
RewriteCond %{REQUEST_URI} ^/wp/wp-cron\.php [OR]
RewriteCond %{REQUEST_URI} ^/wp/wp-admin/admin-ajax\.php [OR]
RewriteCond %{ENV:adminip} =1
RewriteRule ^ - [L]

# Custom error pages for overloaded server (503/508)
ErrorDocument 503 /maintenance.html
ErrorDocument 508 /maintenance.html

# Show maintenance page to all other users
RewriteCond %{REQUEST_URI} !/maintenance.html
RewriteRule ^.*$ /maintenance.html [R=302,L]


# ========================================================
# cPanel PHP HANDLER (unchanged)
# ========================================================
# 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


# ========================================================
# cPanel PHP ini settings (untouched)
# ========================================================
# 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
<IfModule php8_module>
   php_flag display_errors Off
   php_value max_execution_time 120
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 256M
   php_value post_max_size 8M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php82"
   php_value upload_max_filesize 2M
   php_flag zlib.output_compression Off
</IfModule>
<IfModule lsapi_module>
   php_flag display_errors Off
   php_value max_execution_time 120
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 256M
   php_value post_max_size 8M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php82"
   php_value upload_max_filesize 2M
   php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit