2017-04-06 28 views
0

我的網址是像如何在yii 1.x中處理'無法解析請求'?

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

該URL通過點擊列表項達到從

e.g 
http://me.mydomain.com/admin/list 

因此在第一URL數字1代表一個ID。

但是當我手動把這樣的事情在URL

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

,並按下鍵盤上的回車鍵,我得到的是說

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

如何處理這種錯誤的錯誤?

回答

1

在我的情況下,我從GIT存儲庫中的文件到我的Windows,本地主機開發環境,它給了我錯誤的URL沒有找到Error404,類似的東西。

Step1-變化的config/main.php如下

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

      ), 

     ) 

步驟2現在修改烏爾應用.htaccess文件,其中建議立即進行刪除剛剛在外面保護的文件夾一些rewite規則如下.... 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.and檢查瀏覽器

Step4-變化http.config與允許改寫一切,我無(無從安全角度重新檢查此步驟)。

這可能會或可能不會幫助你

0

檢查區分大小寫。這可能會導致問題。

+0

這不是大小寫區分..因爲正如我所說,當我手動輸入URL作爲參數的非ID。手動「按下鍵盤的回車鍵」..這是我得到我提到的錯誤的時間。但是如果ID實際上存在於數據庫中。它根本沒有錯誤 – sasori