Subdomains control for url in slim


Hi there,

I would like to create multiple sudbomain eg:

these subdomains will be dynamic and I would like to have different controllers based on the subdomain and load from a single twig file

I am still new to the slim framework so apollogies for the noob question

Domain and subdomain routing

There is not any built-in support for parsing subdomains. However, here’s how I would do this. I would configure the default Nginx virtual host to answer for these subdomains. The virtual host will direct all PHP requests to the appropriate Slim bootstrap file. You can write a simple Slim middleware that parses the request subdomain so you can take the necessary actions in your route callbacks. Does this make sense?

Slim with sub domain