我无法在 Yii 中配置路由项目是 3 天,都试图帮助......我有:
/var/www/ - 项目
/var/www/yii - yii 框架
./htaccess
RewriteEngine On
# Put your installation directory here:
# If your URL is www.example.com/, use /
# If your URL is http://localhost/begin/, use /begin/
RewriteBase /
# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# For reuests that are not actual files or directories,
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
index.php 发现。
./var/www/protected/config/main.php
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName' => false,
'rules'=>array(
'/'=>'/view',
'//'=>'/',
'/'=>'/',
),
),
例如,当我输入 107.170.91.28/site/contact 时,会显示错误 404。服务器 107.170.91.28 的 URL 在本地服务器上。一切正常。如果我输入此 URL 107.170.91.28/index.php/site/contact 或 107.170.91.28/index.php?r=site/contact - 它可以工作。寻求帮助,因为我尝试了所有设置的方法。