# Laravel API root — send all requests into /public (cPanel / Apache)
<IfModule mod_rewrite.c>
    Options -Indexes
    RewriteEngine On

    # If the app lives at https://domain.com/api/ set this to /api/ (uncomment when needed):
    # RewriteBase /api/

    # Already under /public — do not rewrite again
    RewriteRule ^public/ - [L]

    # Static files inside public/ (css, js, storage, etc.)
    RewriteCond %{DOCUMENT_ROOT}/public/$1 -f [OR]
    RewriteCond %{DOCUMENT_ROOT}/public/$1 -d
    RewriteRule ^(.*)$ public/$1 [L]

    # Everything else → Laravel front controller
    RewriteRule ^(.*)$ public/index.php [L]
</IfModule>

# Fallback when mod_rewrite is off (some shared hosts)
<IfModule !mod_rewrite.c>
    DirectoryIndex index.php
</IfModule>
