Custom Url

I’m a newbie in Yii, I’m learning it.

Today I’m learning URL management.

I am using path URL structure and it works correctly.

But I want more.

For example:

I have this: //localhost/MyYiiApp/content/display?alias=something

where content is my controller’s name, display is my action’s name, and alias is a parameter in the URL.

I would like to see only the parameter in my URL with this controller/action pair, so I would like to hide my controller/action name from URL, so I would like to convert into this:

//localhost/MyYiiApp/something

What rule should I write into the rules array of URL manager in the config/main.php file?

ps.: Sorry for my English :)




'<alias>'=>'content/display',



Ohh, is it really so simple? :)

It works! Thanks!

Edit: uhhh, Gii now stoped working :(

If I comment the line ‘<alias>’=>‘content/display’, Gii works,

if I uncomment it, Gii not working :(

There is some problem.


'<alias>'=>'content/display',

works, but when I try to open Gii with this URL:

//localhost/MyYiiApp/gii

this calls my Display action in my Content controller, and that miss alias parameter.

What is the problem?

Of course, "gii" now matches your rule. You can still use gii/default/index.