createUrl is not working properly

Hi

i have to show username in url like http://localhost:90/testyii/Alankar. where [color="#FF0000"]Alankar[/color] is username.

i user url rule ‘<firstname:\w+>’=>‘person/show’. rule is given below

'rules'=&gt;array(


			'&lt;controller:&#092;w+&gt;/&lt;id:&#092;d+&gt;'=&gt;array('&lt;controller&gt;/view','urlSuffix'=&gt;'.jsp'),


			'&lt;controller:&#092;w+&gt;/&lt;action:&#092;w+&gt;/&lt;id:&#092;d+&gt;'=&gt;'&lt;controller&gt;/&lt;action&gt;',


			'&lt;controller:&#092;w+&gt;/&lt;action:&#092;w+&gt;'=&gt;'&lt;controller&gt;/&lt;action&gt;',


			'&lt;firstname:&#092;w+&gt;'=&gt;'person/show',


		),


		'showScriptName'=&gt;false,

Now if i am entering url http://localhost:90/testyii/Alankar is working perfectly but i am using createUrl to generate a such url.

echo ‘<a href="’.Yii::app()->createUrl(’/person/show’,array(‘firstname’=>‘Abhishek’)).’" >Testing</a>’;

inspite of showing http://localhost:90/testyii/Alankar it shows http://localhost:90/testyii/person/show?firstname=Alankar

and what is the meaning of w,d,S in url rules

please help me to resolve this issue

thanks in advance

Have a look at this topic from the guide:

http://www.yiiframework.com/doc/guide/1.1/en/topics.url

You need to modify your config:




array(

    ......

    'components'=>array(

        ......

        'urlManager'=>array(

            'urlFormat'=>'path',

        ),

    ),

);



Concerning the "meaning of w,d,S", have a look at some information about regular expressions.

Hi thanks for your reply

i did it but createUrl is not generation current seo friendly url

Mind posting your config so we can have a look at it?

config file is attached with it

Hi All :)

After lot g :angry: :) gling i found a simple solution. just put specific rules at the begining and then other general rules.

---------------------------Wrong Position---------------------------

‘rules’=>array(

‘<controller:\w+>/<id:\d+>’=>array(’<controller>/view’,‘urlSuffix’=>’.jsp’),

‘<controller:\w+>/<action:\w+>/<id:\d+>’=>’<controller>/<action>’,

‘<controller:\w+>/<action:\w+>’=>’<controller>/<action>’,

[color="#FF0000"]’<firstname:\w+>’=>‘person/show’[/color],

),


---------------------------Correct Position---------------------------

‘rules’=>array(

[color="#FF0000"]’<firstname:\w+>’=>‘person/show’,[/color]

‘<controller:\w+>/<id:\d+>’=>array(’<controller>/view’,‘urlSuffix’=>’.jsp’),

‘<controller:\w+>/<action:\w+>/<id:\d+>’=>’<controller>/<action>’,

‘<controller:\w+>/<action:\w+>’=>’<controller>/<action>’,

),


Hope this will help others :)