[英]Can't configure routing Yii?
Forgive me for such a frequent situation, I searched the Internet. 原谅我这么频繁的情况,我上网搜索了。 I tried it, I didn't have anything goes.
我尝试过,没有任何进展。 I can't configure routing in Yii.
我无法在Yii中配置路由。 I would be grateful if anybody can help a beginner:
如果有人可以帮助初学者,我将不胜感激:
1) I have a finished project to Yii. 1)我已经完成了Yii的项目。
2) I have the cloud to digitalocean, installed the LAMP, in the/var/www/html uploaded project. 2)在/ var / www / html上传的项目中,我有要数字化的云,安装了LAMP。
3) My /var/www/html/.htaccess 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 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 5)/var/www/html/protected/.htaccess
deny from all
6) Yii framework in /var/www/yii. 6)/ var / www / yii中的Yii框架。
If you enter the URL of the project via a browser, enter /var/www/html/, /var/www/yii/does not see, is this normal? 如果通过浏览器输入项目的URL,请输入/ var / www / html /,/ var / www / yii /看不到,这正常吗? Tell me how to configure the correct routing?
告诉我如何配置正确的路由? (without "/?r=").
(不带“ /?r =“)。 Folders 777, Files 666 rewrite_module (shared)
文件夹777,文件666 rewrite_module(共享)
Well I would suggest to change your .htaccess file from ( http://www.yiiframework.com/wiki/427/htaccess-seo-friendly-url/ ) 好吧,我建议您从( 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]
Now if you have not set virtual host and application is in some folder like /var/www/html/MySite. 现在,如果您尚未设置虚拟主机,则应用程序位于/ var / www / html / MySite等文件夹中。 Then change RewriteBase in .htaccess to
RewriteBase /MySite
然后将.htaccess中的
RewriteBase /MySite
更改为RewriteBase /MySite
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.