UrlManager - Rules to servername (subdomain » module)


(Mandachuvamg) #1

Hi!

I need to point a subdomain to a module.

'rules' => [ //supplier.mydomain.com => suppliers ]

But when I use any route other than the main one (example: provider.mydomain.com/default/logout) it doesn’t work (error 404).

Tks.


(Andro) #2

You can use patterns in rules. #URLrules
I did something like this:
[ '//<subdomain:\w+>.mydomain.com' => 'controller/index' ]
The subdomain is available to the controller as a param.