原谅我经常出现这种情况,我上网搜索了一下。我试过了,什么都没做。我无法在Yii中配置路由。如果有人能帮助初学者,我将不胜感激:
我有一个完成的项目到Yii。
2)我把云转到digitalocean,安装了LAMP,在/var/www/html上传项目。
3) My/var/www/html/.htaccessRewriteEngine 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) Yii框架在/var/www/Yii .
如果通过浏览器输入项目的URL,输入/var/www/html/,/var/www/yii/看不到,这正常吗?请告诉我如何配置正确的路由?(没有"/? r =")。文件夹777,文件666rewrite_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修改为RewriteBase /MySite