2014-10-01 65 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机器,然后一切运作良好。感谢您的答案。