如何处理'无法解决请求'在yii 1.x?

时间:2017-04-06 00:23:39

标签: yii

我的网址就像

e.g http://me.mydomain.com/admin/view/1

点击

中的列表项即可到达该网址
e.g 
http://me.mydomain.com/admin/list

因此第一个网址中的数字1代表一个ID。

但是当我在网址中手动输入这样的内容时

e.g
http://me.mydomain.com/admin/view/asdfasdf1234

并按下键盘的回车键,我收到错误消息

Unable to resolve the request "http://me.mydomain.com/admin/view/asdfasdf1234".

如何处理此错误?

2 个答案:

答案 0 :(得分:1)

在我的情况下,我将文件从GIT存储库导入到我的windows,localhost开发环境中,它给了我错误URL未找到Error404,就像那样。

Step1-更改config / main.php如下

'urlManager' => array( 
    'urlFormat' => 'path',
    'showScriptName' => false,
    'rules' => array(              
                        '/' => '/view',
                        '//' => '/',
                        '/' => '/',

            ),

        )

步骤2现在修改你的应用程序.htaccess文件,它应该在受保护文件夹之外的一些重写规则如下....

上的RewriteEngine
# 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

步骤3-重新启动apache。并在浏览器中检查

Step4-使用Allow Override All更改http.config,取代None。(从安全角度重新检查此步骤)。

这可能会或可能不会帮助您

答案 1 :(得分:0)

检查区分大小写。这可能会导致问题。