设置yii admin部分

时间:2016-03-18 20:16:41

标签: php model-view-controller yii yii-url-manager

我想在现有的yii项目中创建管理面板。为此,我使用this link

现在我可以访问" localhost / dir / backend.php"。我希望这个网址为" localhost / dir / backend"并且还希望管理登录和管理员中的其他链接。 我的配置文件代码是

'urlManager' => array(
    'urlFormat' => 'path',
    'showScriptName' => false,
    'rules' => array(
        'admin' => 'site/index',
        'admin/<_c>' => '<_c>',
        'admin/<_c>/<_a>' => '<_c>/<_a>',
    ),
),

请告诉我如何访问以上网址和登录网址以及管理员的其他网址。 谢谢

1 个答案:

答案 0 :(得分:0)

如果您在Apache上运行应用程序,则需要使用以下规则添加.htaccess app root

RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php