Yii Framework Forum: Help With Url Routes - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Help With Url Routes Rate Topic: -----

#1 User is offline   Sauls 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 18-March 11

Posted 04 March 2013 - 09:12 AM

Can someone help me to get it right. I have a url: mysite.com/c?r=11&d=5555 , how to make a rule to this link that it points to mysite.com/site/myaction
I have done like this:

 'urlManager'=>array(
                'urlFormat'=>'path',
                'showScriptName'=>false,
                'rules'=>array(
                    '<alias:c>'=>array('site/myaction'),
                    '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
                ),
            ),


But after I go to mysite.com/c?r=11&d=5555 it says "bad request 11"
0

#2 User is offline   Sauls 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 18-March 11

Posted 04 March 2013 - 01:09 PM

View PostSauls, on 04 March 2013 - 09:12 AM, said:

Can someone help me to get it right. I have a url: mysite.com/c?r=11&d=5555 , how to make a rule to this link that it points to mysite.com/site/myaction
I have done like this:

 'urlManager'=>array(
                'urlFormat'=>'path',
                'showScriptName'=>false,
                'rules'=>array(
                    '<alias:c>'=>array('site/myaction'),
                    '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
                ),
            ),


But after I go to mysite.com/c?r=11&d=5555 it says "bad request 11"


After some investigation found the solution, that worked. Simply I needed to change the default route variable
'routeVar'=>'route'

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users