2

i want this URL: http://m.mysite.com/XYZ12
to redirect here: http://m.mysite.com/index.php?r=myBook/mobile&oid=XYZ12

Note: XYZ12 will be a dynamic string

Cœur
  • 37,241
  • 25
  • 195
  • 267

2 Answers2

0

in your config.php put something like this:

array(
......
'components'=>array(
    ......
    'urlManager'=>array(
        'urlFormat'=>'path',
        'rules'=>array(
            '<oid:\w+>'=>'myBook/mobile',
            ),
        ),
    ),
);

It is in the manual too: http://www.yiiframework.com/doc/guide/1.1/en/topics.url

HarryFink
  • 1,010
  • 1
  • 6
  • 6
0

Try this one:

RewriteEngine on
RewriteRule ^/(.*)$ /index.php?r=myBook/mobile&oid=$1 [R,L]

It will redirect /something to /index.php?r=myBook/mobile&oid=something

dAm2K
  • 9,923
  • 5
  • 44
  • 47