将.htaccess中的域重定向到yii应用程序

将.htaccess中的域重定向到yii应用程序,.htaccess,redirect,yii,.htaccess,Redirect,Yii,我需要在服务器根目录中的.htaccess中重定向域。 我的.htaccess: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC] RewriteCond %{REQUEST_FILENAME} !/yii/projectName/ RewriteRule ^(.*)$ /yii/projectName/$1 [L] 主页应用程序工作,但url管理器不工作,它总是重定向到主页 我的经理: 'urlForma

我需要在服务器根目录中的.htaccess中重定向域。 我的.htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !/yii/projectName/
RewriteRule ^(.*)$ /yii/projectName/$1 [L]
主页应用程序工作,但url管理器不工作,它总是重定向到主页

我的经理:

'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
...
),
感谢您的帮助

试试这个:

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
一年前我在这里找到了这个替代方案:

编辑:

URL管理器设置似乎正常,但请确保在自定义URL规则之后添加以下规则:

'rules'=>array(

            // ... add you custom url rules here, if there are any

            // Home page
            '/' => 'info/index', // edit this to your home page controller/action

            // Default patterns for any other controller/actions.
            // These are checked last, if there were no applicable custom rules for a specific URL
            '<controller:\w+>/<id:\d+>' => '<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
            '<controller:\w+>/<action:\w+>/*' => '<controller>/<action>'
),

这个问题似乎离题了,因为它是关于网站管理员的。没有人试图在yii应用程序上重定向.htaccess root-serwer中的域?