**Symfony version(s) affected**: ^5.1.9 **Description** https://github.com/symfony/symfony/pull/38614 introduce a BC when using URL rewriting and that the URI contains the same string as the subdomain. **How to reproduce** 1. Setup URL rewriting from `domain.com/index.php/api` to `api.domain.com` 2. Add a route containing `/api/` (for example `@Route("/foo/api/bar")`) 3. Go to `api.domain.com/foo/api/bar`, you will have a 404 **Possible Solution** Change the if in the PR to not change `$basename` when the URI contains the subdomain where `strpos !== 0`, basically revert the PR.