How exactly do you pass variables to controller actions via url?

This is really odd. I could swear this worked before, but I’m having trouble setting it up now.

I downloaded Yii 1.1.19 and started from scratch. Unzipped, and went straight to


It worked, no problems. Then, I went into SiteController.php and modified the actionContact.


public function actionContact() {




public function actionContact($string) {

echo $string;



Now, if I go to localhost/yii2/demos/blog/index.php/site/contact/testString, it gives 400 error.

What am I doing wrong? Too used to codeigniter now >_>


Needs to be:


Unless you write your own route rules the variable name needs to precede the variable value.