Symfony sub domain routing

How can we use sub domains to access sub folders in Symfony. The question is, how can I have a sub domain routed to a folder? example.com -> example.com/* app.example.com -> example….