# SULLY TEST ROOT CONFIG
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    DirectoryIndex public/login.html

    <Directory /var/www/html>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
        RewriteEngine On

        # Bloquear acceso a directorios protegidos
        RewriteRule ^(storage|config|modules|middleware|scripts)/ - [F,L]

        # Bloquear archivos sensibles
        RewriteRule \.(env|md|sql|log|sqlite)$ - [F,L]

        # Si el archivo existe, servirlo directamente
        RewriteCond %{REQUEST_FILENAME} -f
        RewriteRule ^ - [L]

        # Si no existe pero existe con .php, ejecutarlo
        RewriteCond %{REQUEST_FILENAME}.php -f
        RewriteRule ^(.*)$ $1.php [L]
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
</VirtualHost>