0

I want to use my url manager something link that.For my blog details

http://example.com/yii-fremwork-install => it gose to blog controller details method

where "yii-fremwork-install" is slug of come from database.

and also wont a module for that i write my url manager something like that

'rules' => array(
                '<slug:.+>' => 'users/details',
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',

            ),

But when i rty to use my admin module

http://example.com/admin it go to user/details controller hoe to use this

Can some one give some idea to solve this issue.

1 Answer 1

0

The problem here is that <slug:.+> is used for every route.

You have to manually define all you controller in the rules array and define them first

Like this :

'rules' => array(
            '<controller:admin|default|item>' => '<controller>',
            '<controller:admin|default|item>/<id:\d+>' => '<controller>/view',
            '<controller:admin|default|item>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
            '<controller:admin|default|item>/<action:\w+>' => '<controller>/<action>',
            '<slug:.+>' => 'users/details',
        ),

Where your 3 other controllers are (as an example) AdminController, DefaultController and ItemController

Sign up to request clarification or add additional context in comments.

2 Comments

And if you add a first line with just <controller> ? Like I did in editing my answer
I have solved this issue using '<slug:[0-9a-zA-Z\-]+>/?' => 'users/ServiceProfile',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.