我从https://github.com/travisstroud/yiiSkeletonApp
下载了yiiSkeletonApp设法让localhost/dev
正常工作,但当我点击登录/注册时,我收到错误404.
登录网址和注册网址为http://localhost/dev/login
和http://localhost/dev/user/create
在我的 protectd / config / main.php 中,我有这个..
'urlManager' => array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
),
文件 protected / views / site / login.php 和 protected / views / user / create.php 确实存在
这是错误消息
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
文件夹内容:
localhost/dev/
- assets/
- css/
- images/
- protected/
- themes/
- yii/
- facebook-channel.php
- index.php
- index-test.php
- README.md
答案 0 :(得分:6)
您的网站配置为使用硬编码路径。所以它指的是错误的路径。
尝试从localhost
访问此网址localhost/dev/index.php/site/login
localhost/dev/index.php/site/user/create
urlManager没有问题。您可以参考此链接以了解yii的URL管理器。