2

我想要这个 URL:http://m.mysite.com/XYZ12
重定向到这里: http://m.mysite.com/index.php?r=myBook/mobile&oid= XYZ12

注意:XYZ12 将是一个动态字符串

4

2 回答 2

0

在您的 config.php 中放置如下内容:

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

它也在手册中:http ://www.yiiframework.com/doc/guide/1.1/en/topics.url

于 2013-06-11T11:51:38.150 回答
0

试试这个:

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

它将 /something 重定向到 /index.php?r=myBook/mobile&oid=something

于 2013-06-11T11:53:35.783 回答