Yii Framework Forum

Url rule for different store login


(Adinugro) #1

Dear all,

I made a POS app with multi store feature. I want each store can login using parameterized login page like

http://mypos-app.com/amstore or
http://mypos-app.com/idstore

both pages actually serve by SiteController/index.php. the amstore and idstore will become the variable to differentiate to which the store will be the active store.

Can someone help?


(Alirz23) #2

enable pretty urls urlManager config/web.php

'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
    'rules' => [
        '<storeId:[\w+]>' => 'site/index',
        '<controller:\w+>/<action:\w+>' => '<controller>/<action>'
    ],
]

// controller action index
public function indexAction($actionId)
{
    echo $actionId;
}