RewriteEngine On

# Job ID routing (MUST come first, before generic PHP routing)
RewriteRule ^([A-Z0-9]{6})$ status.php?job_id=$1 [NC,L,QSA]

# Alternative: also handle /status/JOBID format
RewriteRule ^status/([A-Z0-9]{6})$ status.php?job_id=$1 [NC,L,QSA]

# Generic PHP file routing (comes AFTER specific routes)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]

# Security headers
<IfModule mod_headers.c>
    Header always set X-Content-Type-Options nosniff
    Header always set X-Frame-Options DENY
    Header always set X-XSS-Protection "1; mode=block"
</IfModule>

# HTTPS redirect (uncomment for production)
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]