1

我试图访问我的 Yii 代码生成器 Gii。但是当我使用它浏览它时

http://localhost/mysite/gii/index/

页面说

错误 404 无法解析请求“gii/index”。

这是我用于 url 重写的 .htaccess 文件

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php

这是我的配置文件中的 url 管理器

    'urlManager'=>array(
        'urlFormat'=>'path',
        'rules'=>array(
            '<controller:\w+>/<id:\d+>'=>'<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
            '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        //pages
        '<view>'=>array('site/page'),
        ),
    ),

我做错了什么吗?http://localhost/mysite/gii/index/显示了 gii 代码生成器的布局,但显示了错误 404 ...

谢谢

PS 我还尝试关闭我的 URL 管理器,看看我的 Gii 代码生成器页面是否会默认使用这个 URL http://localhost/mysite/index.php?r=gii/default/login 并且它可以工作.. .

4

2 回答 2

1

如果您使用相同的配置遇到相同的问题,我确实使用了这个 URL http://localhost/mysite/gii/default/login

^ _ ^

于 2012-03-06T02:38:09.697 回答
0

使用这个.htaccess:

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

并尝试您的网址:

http://localhost/mysite/gii/index/
于 2012-03-06T06:26:07.113 回答