RewriteEngine On
RewriteBase /lineup_2026/

# Set environment variables for lineup_2025
SetEnv LINEUP_2025_DB_USER data
SetEnv LINEUP_2025_DB_PASSWORD ncc1701D
SetEnv LINEUP_2025_DB_NAME lineup_2026_test

# Ensure PHP files are handled by PHP (for mod_php)
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php

# Alternative for PHP-FPM (uncomment if using PHP-FPM)
# SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost/"

# Pass Authorization header for FastCGI
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

# Route all Lineup API requests to api.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ api.php/$1 [QSA,L]

# Add debug header to confirm rewrite
Header always set X-Rewrite-Debug "Rewritten to api.php" env=REDIRECT_STATUS

# Prevent access to .htaccess and sensitive files
<Files ".ht*">
    Require all denied
</Files>
   