I have set a single CodeIgniter4 to work on www.example.com/controller/method, but I also need certain groups of controllers (like api) to work only from api.example.com/controller/method May I ask you guys for a best practice approach to achieve this ?
It seems the right way to do it was indicated by @DhavalChheda
The way I have done is, I have segregated the controllers and routes at the base of the Project. For example , the main routes are in the app/Routes folder (which is by default). And to differentiate the subdomains folder, they are definited in Subdomain/app/Routes and their respective logics are in app/Controllers and Subdomain/app/Controllers.