[Solved] Symfony sub domain routing

This solution will intercept the REQUEST_URI and add the subdomain as a root folder if not already used. Meaning app.example.com and app.example.com/app will both access the same page. if(substr($_SERVER[‘HTTP_HOST’], 0, strlen(‘app.’)) === ‘app.’ && substr($_SERVER[‘REQUEST_URI’], 0, strlen(‘/app’)) !== ‘/app’) { $_SERVER[‘REQUEST_URI’] = ‘/app’.$_SERVER[‘REQUEST_URI’]; } The benefit of this is being able to put all your … Read more