Reputation: 167
I have a site where I want a different experience for each state, and need the url to be related to the city. So instead of mysite.com/site/login
it would be
mysite.com/utah/site/login mysite.com/colorado/site/login etc
And this would apply to all urls:
mysite.com/services/view/1 becomes mysite.com/utah/services/view/1
mysites.com/customer/purchase-order/create becomes mysites.com/coloroda/purchase-order/create
etc, etc, etc
Upvotes: 3
Views: 90
Reputation: 421
Have you tried to use pattern
Yii::createObject([
'class' => UrlRule::class,
'pattern' => '<city>/site/view<id:\d+>',
'route' => 'site/view',
]),
Where city
and id
are input parameters to the actionView
in SiteController
Upvotes: 0