Looking for help with urls


(Kacykos) #1

Hi i have yii website script and I don’t know how to change urls from mydomain.com/account/login to mydomain.com/login.

Can someone write instruction for me? I can send you ftp details to login on serverif you need it. Thanks for help


(Avoime) #2

config urlmanager


'urlManager' => [

            'enablePrettyUrl' => true,

            'showScriptName' => false,

            'rules' => [

                // custom rules

                'login' => 'account/login',

                // default rules

                '<controller:\w+>/<id:\d+>' => '<controller>/view',

                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',

            ],

        ],


(Kacykos) #3

Thanks for reply i Have this


 'urlManager' => [

            'enablePrettyUrl' => true,

            'showScriptName' => false,

            'enableStrictParsing' => false,

            'rules' => [

                'search' => 'site/search',

                'contact' => 'site/contact',

                '<controller:conversation>/<action:delete>' => '<controller>/<action>',

                '<controller:conversation>/<action:reply>/<conversation_uid:[a-z0-9_\-]+>' => '<controller>/<action>',

                '<controller:account>/<action:invoices>/<page:\d+>' => '<controller>/<action>',

                '<controller:account>/<action:conversations>/<page:\d+>' => '<controller>/<action>',

                '<controller:listing>/<action:index|update|package|preview>/<slug:[a-z0-9_\-]+>' => '<controller>/<action>',

                'page/<slug:[a-z0-9_\-]+>' => 'pages/index',

                '<controller:category>/<action:location>' => '<controller>/<action>',

                [

                    'pattern' => 'category/<slug:[a-z0-9_\-]+>/<page:\d+>',

                    'route' => 'category/index',

                ],

                [

                    'pattern' => 'category/<slug:[a-z0-9_\-]+>',

                    'route' => 'category/index',

                ],

                [

                    'pattern' => 'store/<slug:[a-z0-9_\-]+>/<page:\d+>',

                    'route' => 'store/index',

                ],

                [

                    'pattern' => 'store/<slug:[a-z0-9_\-]+>',

                    'route' => 'store/index',

                ],

                '<url:.+/>' => 'site/redirect'

            ],

        ],

if i change ‘search’ => ‘site/search’, to ‘search’ => ‘site/szukaj’

mydomain.com/szukaj don’t work ;/