[英]yii rewrite url not found
我有这个.htaccess
脚本:
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的屏幕
可能是什么问题呢? 找不到控制器/操作的所有URL(404)
确保必须启用Apache“ AllowOverride all”
您也可以尝试以下.htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
在protected / config / main.php中的main.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>', ), ),
这是设备/操作系统错误,我重新启动了ubuntu计算机,然后一切正常。 感谢您的回答。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.