如何重定向到另一个条目脚本?

时间:2021-09-04 07:13:15

I have two entry scripts on my application, as specified here. How can I set the route to redirect /example.com/admin to example.com/backend.php

我的应用程序上有两个入口脚本,如此处所指定。如何设置将/example.com/admin重定向到example.com/backend.php的路由

Thanks.

谢谢。

1 个解决方案

#1


3  

Take a look at the documentation about URL management:

请查看有关URL管理的文档:

Without knowing the details of your setup, in your protected/config/main.php (if main.php is you application configuration file), you would need something along this:

在不知道您的设置细节的情况下,在您的protected / config / main.php中(如果main.php是您的应用程序配置文件),您将需要以下内容:

// note: this is extracted from a project which uses 'friedly urls',
//       depending on your setup, YMMV
'urlManager'=>array(
    'urlFormat'=>'path',
    'showScriptName' => false,
    'rules'=>array(
        '<controller:\w+>/<id:\d+>'=>'<controller>/view',
        '/admin'=>'/backend',    // <-- define your custom routes/redirects here
    ),
),

#1


3  

Take a look at the documentation about URL management:

请查看有关URL管理的文档:

Without knowing the details of your setup, in your protected/config/main.php (if main.php is you application configuration file), you would need something along this:

在不知道您的设置细节的情况下,在您的protected / config / main.php中(如果main.php是您的应用程序配置文件),您将需要以下内容:

// note: this is extracted from a project which uses 'friedly urls',
//       depending on your setup, YMMV
'urlManager'=>array(
    'urlFormat'=>'path',
    'showScriptName' => false,
    'rules'=>array(
        '<controller:\w+>/<id:\d+>'=>'<controller>/view',
        '/admin'=>'/backend',    // <-- define your custom routes/redirects here
    ),
),