Yii 易1.1中的搜索引擎优化友好url

Yii 易1.1中的搜索引擎优化友好url,yii,friendly-url,yii-url-manager,Yii,Friendly Url,Yii Url Manager,我只想让SanphamController拥有以下功能: mySite/sanpham/chitiet/slug/nuoc-hoa-phap-vuiton.html 到 mySite/nuoc-hoa-phap-vuiton.html 我已经处理过了,但所有其他的控制器,等等,。。在我的网站不再运行时,它认为控制器是SanPhamController中的一项 这是我的密码 .htaccess: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-

我只想让SanphamController拥有以下功能:

mySite/sanpham/chitiet/slug/nuoc-hoa-phap-vuiton.html

mySite/nuoc-hoa-phap-vuiton.html

我已经处理过了,但所有其他的控制器,等等,。。在我的网站不再运行时,它认为控制器是SanPhamController中的一项

这是我的密码

.htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
在main/config.php中:

'urlManager' => array(
        'rules' => array(
            '/'=>'site/index',
            '<view:(gioi-thieu|huong-dan|hinh-thuc-thanh-toan|dieu-khoan-dich-vu|chinh-sach-dich-vu)>' => 'site/page',
            '<action:(lienhe|thanhtoan|dangnhap|dangky|dangxuat)>' => 'site/<action>',
            'danh-muc/<slug:.*>'=>'sanpham/danhmuc',
            'thuong-hieu/<slug:.*>'=>'sanpham/thuonghieu',
            'tim-kiem/<slug:.*>'=>'sanpham/timkiem',
            '<slug:.*>' => 'sanpham/chitiet',
            '<controller:\w+>/<id:\d+>' => '<controller>/chitiet',
            '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
            '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
        ),
        'urlFormat' => 'path',
        'urlSuffix' => '.html',
        'showScriptName' => false,
),

只需在url管理器数组的顶部添加此规则:

"nuoc-hoa-phap-vuiton"=>"sanpham/chitiet/slug/nuoc-hoa-phap-vuiton"

nuoc hoa phap vuiton只是行动指南中的一个模型项目。我已经这样做了,但它与其他控制器名称混淆。示例:mySite/cart/index不再工作。在检查是否是sanpham/chitiet中的项目之前,如何运行yii默认规则?您可以将该规则放在url规则的末尾或yii默认规则之前的用户定义url规则的末尾。