Module and URL management


(Sirinibin2006) #21

Thansk alot for this code… Worked well for me…

i was trying to apply few Rules specifically for a my api module…


(Konapaz) #22

The only way I found is described here

http://www.yiiframework.com/forum/index.php/topic/9471-set-urlmanager-in-a-module/page__view__findpost__p__262505

but is a little hack


(Marciocamello) #23

Look this rule

‘<module:\w+>/<controller:\w+>/<action>/<id:\d+>’=>’<module>/<controller>/<action>’,

Works for me in all modules, controllers and actions with modules


(Ash Finlayson) #24

Thats the zend2 approach, like it.

Would that also mean that one is ultimately putting less rules in the main config therefore speeding up load time?


(Alexander Makarov) #25

Putting less rules — yes. Speeding up — no since you have to check rules regardless of their source.


(Steve) #26

Qiang this would be an excellent feature!

We have built many apps using Yii from small to very large complex apps modules are essential and this is precisely how we currently use Yii 1. Each module has a startup and we override the rules there… But it would be excellent to have this lower in the framework.

Is this currently in Yii 2.0 now? Did it get implemented?


(rssreader) #27

I have set
defaultRoute = “mainnewmodule”;

URL https://www.example.com/default/index => mainnewmodule/controllers/DefaultController::actionIndex
Works OK.

But:
URL https://www.example.com/mainnewmodule/default/index
returns the same content. How to disable this duplication? I don’t want to use a URL “https://www.example.com/mainnewmodule”. What is the easiest solution?

Thanks for help.