Curlmanager Doesn't Working Properly

Here I’ve an issue with CUrlManager.

See, below is my urlRules:




/* 1 */  '<year:\d{4}>' => "magazine/index",

/* 2 */  '<year:\d{4}>/<month:\d{2}>' => "magazine/index",

/* 3 */  '<year:\d{4}>/<month:\d{2}>/<day:\d{2}>' => "magazine/index",

/* 4 */  '<year:\d{4}>/<month:\d{2}>/<day:\d{2}>/<context:.*>' => "magazine/index",

/* ----------------------------------------------------------------------------------- */

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

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

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



Now, the problem is:

When I made a request http://localhost/new...s.in/2013/01/18, this doesn’t work. Because this applies rule no. 7 above rather than no. 3.

But when I made a request http://localhost/new…-asdf-asd-fsad. This works perfectively. Because this is works on rule no. 4.

OR

Am I doing something wrong?

I tried this and it works for me… c[size=2]an you post your whole urlManager config?[/size]

For others, so they don’t need to download the file you posted… here is your url config





        'urlManager' => array(

            //'class' => "UrlManager",

            'urlFormat' => "path",

            'rules' => array(

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

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

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

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

                // ---------

                '<year:\d{4}>' => "magazine/index",

                '<year:\d{4}>/<month:\d{2}>' => "magazine/index",

                '<year:\d{4}>/<month:\d{2}>/<day:\d{2}>' => "magazine/index",

                '<year:\d{4}>/<month:\d{2}>/<day:\d{2}>/<context:.*>' => "magazine/index",

                // ---------

                '<controller:\w+>/<action:\w+>-<append:\w+>' => "<controller>/<action>_<append>",

                '<controller:\w+>/<action:\w+>-<append:\w+>/<id:\d+>' => "<controller>/<action>_<append>",

                '<controller:\w+>/<action:\w+>-<append:\w+>-<append2:\w+>' => "<controller>/<action>_<append>_<append2>",

                '<controller:\w+>/<action:\w+>-<append:\w+>-<append2:\w+>/<id:\d+>' => "<controller>/<action>_<append>_<append2>",

                // ---------

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

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

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

            //'<controller:\w+>/<action:\w+>/<appcode:[\w+]{30,32}>' => "<controller>/<action>",

            //'<controller:\w+>/upload-video/<appcode:[\w+]{30,32}>' => "<controller>/video_upload",

            ),

        ),



The url manager when deciding which rule to take gets from bottom to top and the first rule that works is taken, others are not checked…

So here in your case… it’s not really how you described on the first post… because you have some rules before the one with the date(s)… try to remove the “modules” rules and you will see that this will work for you… note that by naming a variable “module” does not make Yii “know” that you are working with a module ;)

Thanks a lot. It works

I was added &lt;module&gt; in rules because I was facing some issue with module. When I posted this issue to forum some one were suggested me to add &lt;module&gt; for rules and problem was really solved.