2014-10-01 63 views
0

我有這樣的.htaccess腳本:警予重寫URL沒有找到

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 

和重寫引擎是基於我的phpinfo中看到。這裏是的phpinfo

enter image description here

可能是什麼問題的屏幕?所有的URL到控制器/動作未找到(404)

回答

0

確保阿帕奇必須啓用 「所有的AllowOverride」

你也可以試試這個的.htaccess:

RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA] 
0

在你主。位於保護/配置/ main.php PHP文件,取消對URL經理 添加'showScriptName'=>false,,這將使該控制器/行動URL重寫

'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>', ), ),

0

這是一個設備/操作系統錯誤,我重新啓動我的Ubuntu機器,然後一切運作良好。感謝您的答案。