RewriteEngine On
RewriteBase /sbm/public/

# --- WHITELIST PUBLIC ENDPOINTS & STATIC PATHS ---
# Assets and uploads should never hit the front controller
RewriteRule ^(assets/|uploads/) - [L]

# Public PHP pages that must NOT be rewritten to index.php
RewriteRule ^(executive_login\.php|volunteer_register\.php|login_action\.php|check_available\.php)$ - [L]

# --- SERVE REAL FILES/FOLDERS AS-IS ---
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# --- CODEIGNITER FRONT CONTROLLER ---
RewriteCond %{REQUEST_URI} !^/sbm/public/index\.php
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

# Old paths redirects (keep as is)
RedirectMatch 301 ^/sbn/waste_seg_form/public/uploads/(.*)$ /sbm/public/uploads/$1
RedirectMatch 301 ^/waste_seg_form/public/uploads/(.*)$       /sbm/public/uploads/$1
