[英]Can't configure routing Yii?
原谅我这么频繁的情况,我上网搜索了。 我尝试过,没有任何进展。 我无法在Yii中配置路由。 如果有人可以帮助初学者,我将不胜感激:
1)我已经完成了Yii的项目。
2)在/ var / www / html上传的项目中,我有要数字化的云,安装了LAMP。
3)我的/var/www/html/.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
4)/var/www/protected/config/main.php
// uncomment the following to enable URLs in path-format
'urlManager' => array(
'urlFormat' => 'path',
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
//not show index.php
'showScriptName' => false,
),
5)/var/www/html/protected/.htaccess
deny from all
6)/ var / www / yii中的Yii框架。
如果通过浏览器输入项目的URL,请输入/ var / www / html /,/ var / www / yii /看不到,这正常吗? 告诉我如何配置正确的路由? (不带“ /?r =“)。 文件夹777,文件666 rewrite_module(共享)
好吧,我建议您从( http://www.yiiframework.com/wiki/427/htaccess-seo-friendly-url/ )更改您的.htaccess文件
RewriteEngine on
RewriteBase /
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php)
# otherwise forward it to index.php
RewriteRule ^(.+)$ index.php?$1 [PT,L,QSA]
现在,如果您尚未设置虚拟主机,则应用程序位于/ var / www / html / MySite等文件夹中。 然后将.htaccess中的RewriteBase /MySite
更改为RewriteBase /MySite
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.