# Use the front controller as index file DirectoryIndex index.php # Disabling MultiViews prevents unwanted negotiation Options -MultiViews RewriteEngine On # Determine the RewriteBase automatically and set it as environment variable RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$ RewriteRule .* - [E=BASE:%1] # Sets the HTTP_AUTHORIZATION header removed by Apache RewriteCond %{HTTP:Authorization} .+ RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0] # Redirect to URI without front controller to prevent duplicate content RewriteCond %{ENV:REDIRECT_STATUS} ="" RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=308,L] # Handle UI routes - let Symfony handle /ui/* routes RewriteCond %{REQUEST_URI} ^/ui RewriteRule ^ %{ENV:BASE}/index.php [L] # If the requested filename exists, simply serve it RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ %{ENV:BASE}/index.php [L] RedirectMatch 307 ^/$ /index.php/