CWebModule adds rules to CUrlManager

So, I want my module to add several rules to CUrlManager.

Something like:

class MyModule extends CWebModule{

  public function init(){

    Yii::app() -> urlManager -> addRules($this -> getModuleRules());



  private function getModuleRules(){




The problem is that the module is created only if it exists in path.

In other words: can a module be preloaded and is it right?

The suggested idea of calling addRules() function from config doesn’t suit me.

It’s a module. It must be installed easily without adding to config lots of stuff.

Besides I want those rules to work with routes not acquainted with module name.

Any workaround on this?