<IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Base URL rewriting path
    RewriteBase /bsx_clinic/public/

    # Redirect trailing slashes
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ $1 [L,R=301]

    # Handle Front Controller
    # If the requested file/directory does not exist, route to index.php
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    
    # Hide extensions (optional, to remove .php from visible URLs if someone accesses them directly)
    # However, routing through index.php inherently hides extensions for our MVC routes.
</IfModule>
