Url Manager Rule Not Working

I have created a controller class with the following method:

Controller: TreeController

public function actionTesting($myvar) {

    echo $myvar;


I can access this method via: /tree/testing?myvar=1

Now I tried to use url manager, so I have created this rule:

'test' => 'tree/testing',

I have accessed /test and I get the error message that the parameter myvar is missing. Everything ok so far.

Now I have slightly modified the rule:

'test' => 'tree/testing?myvar=1',

This should work but I do get an error:

Unable to resolve the request: tree/testing?myvar=1

Why? What have I done wrong?

‘tree/testing/<myvar:\d+>’ => ‘tree/testing’,

So this means, that url parameters will be automatically passed to the other route.

This has changed since yii 1.1. Thank you!

Is there a possibility to say that

/tree/testing/1/ should be the same as /tree/testing/1 ?

The slash behind the last parameter is not working. I tried:

‘tree/testing/<myvar:\d+>/’ => ‘tree/testing’

without success.

You can try:

‘tree/testing/<myvar:\d+\/>’ => ‘tree/testing’,