Remove Index NOT index.php

Hello,


$this->widget('zii.widgets.CMenu', 

    array('items'=>array(

          array(

            'label'=>'Eventos',

            'url'=>array('/event/index'),

                                            

          ))

     );

?>

if I make that array to have just


/event/

instead of


/event/index

, it works. BUT that’s not the proper way of doing it, according to the documentation AND, as a plus, YII don’t place the active class on it.

For almost all controllers I have an index action but I wish the URL to be without that /index .

I’ve removed the index.php file, but this index still appears.

Is there a way to remove it ?

which page u want to show?

@mem: read http://www.yiiframework.com/doc/guide/1.1/en/topics.url

I’m having the same problem. I have following the “Special Topics” documentation, but “index” still appears in the URL.

My .htaccess:




 RewriteEngine on

 

 # if a directory or a file exists, use it directly

 RewriteCond %{REQUEST_FILENAME} !-f

 RewriteCond %{REQUEST_FILENAME} !-d

 

 # otherwise forward it to index.php

 RewriteRule . index.php



In my /protected/config/main.php, urlManager is set to:




'urlManager'=>array(

  'urlFormat'=>'path',

  'showScriptName'=>false,

  'caseSensitive'=>true,

    'rules'=>array(

        '<controller:\w+>/<id:\d+>'=>'<controller>/view',

        '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

        '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

    ),

),



If I enter into the browser:


http://somewhere.com/controller?somevar=123

it works as expected (displayed actionIndex()).

Also, entering into the browser:


http://somewhere.com/controller/index/somevar/123

works as expected.

However, when I create an URL with a parameter using createUrl, like so:




$url = Yii::app()->createUrl('controller/index', array('somevar' => 123));



then the URL displayed in the browser is:


http://somewhere.com/controller/index?somevar=123

This is not desirable. What else needs to be done to remove "index" from the URL so that the above example would be:


http://somewhere.com/controller/somevar/123

when using createUrl?