urlManager makes all images disappear when creating a rule

I tried to implement urlManager Component, now my problem is that whenever I call this all my images on the page don’t show, If I disable it it shows again

Without rewrite my URL looks as follows


index.php?r=images/load&cid=1

with urlManager it looks like this below, whenever this is called all the images on my page disappear :frowning:


gallery/category/1

My urlManager rules


'urlManager'=>array(

                    'urlFormat'=>'path',

                    'showScriptName'=>false,

                    'rules'=>

                        'gallery/category/<cid:\d+>'=>'images/

                    ),

                ),

I’m completely lost, since images disappear, but cid can be read. Any help I would appreciatte. Thanks

Is the syntax error in your rule a copy/paste issue?


'gallery/category/<cid:\d+>'=>'images/

If your image looks like


<img src="img/button.gif" />

and your page URI was /gallery/category/1, your image will get requested from /gallery/category/1/img/button.gif which is obviously not what you want. To avoid that, you need to supply an absolute URI to your image (’/’ + baseUrl + image path). You can use the bu() method from here:

http://www.yiiframew…oc/cookbook/31/

My image tags usually look like this:


<img src="<?php bu('img/button.gif') ?>" />

Thanks, that worked