Urlmanager Route Help

Hello! :)

My experience with yii has been pretty basic so far, but I’ve been using it on and off for two or three years now: and, I’m trying to learn about the urlManager next(never had to use it before ;D ).

In the yii guide there is an example of almost exactly what I want to try doing.

They show an example where using this url:


would generate the url "post/100" based on this rule:


I tried using that format but get a blank screen with my version of the rule:


…And my url:


…And when my urlManager rules look like this:


                # my rules

                ''=>'map/index', // home page is maps list

                'map/<id:\d+>'=>'map/getcurrentlocation', // the rule I'm trying to get working

                # yii default rules





If I change the rule I’m trying to get working to this:


I no longer get a blank screen initially, and the data loads as expected: but, the resulting url includes the action name like this:


I was still expecting the url to result in this:


If someone could please point out why I get the blank screen using the original rule format(or let me know that it could be a number of things): and, why using my updated rule format results in having the action name in the generated url, that would be fantastic!

With everything same, could u try this:


Unfortunately, that gives an action not found error, and putting the action name in instead results in the same lengthy url like:


Try this


If this works, then your rule is right and generate such url by simply replacing 10 with variable.

Hmm, that seems to send the request to the actionView in my MapController. BTW I do appreciate your help Ujjwal, thanks!