VChris
(Varadi Krisztian Info)
June 2, 2013, 3:41pm
1
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
Tsunami
(Erik)
June 2, 2013, 3:56pm
2
'<alias>'=>'content/display',
VChris
(Varadi Krisztian Info)
June 2, 2013, 4:22pm
3
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
VChris
(Varadi Krisztian Info)
June 2, 2013, 5:05pm
4
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?
Tsunami
(Erik)
June 2, 2013, 5:52pm
5
Of course, "gii" now matches your rule. You can still use gii/default/index.