Yii 1.14 controller from two parts in module produ

2019-06-09 22:53发布

问题:

i have yii project hosted on Godaddy, i created admin panel as a separated module called "admin", the admin panel works fine in my localhost but when i moved the code to my host all Admin module controllers from two parts example "subCategoryController" stopped working and returns a 404 error, all other controllers that consists from only one part working fine example "user,post,...", they all working fine on my localhost the problem only on my host in godaddy. this is some code snippets that i am using in my htaccess and main.php :

main.php :

urlManager :

    'urlManager' => array(
        'urlFormat' => 'path',
        'showScriptName' => false,
        'caseSensitive' => false,
        'rules' => array(              
            '<controller:\w+>/<id:\d+>' => '<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
            '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
        ),
    ),

.htaccess

Options  +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
    SetEnv HTTP_MOD_REWRITE On
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php 
</IfModule>

Example of Url that i can access : somewebsite.com/admin/user/index

Example of Url i can't access on godaddy but i can access it on my localhost : somewebsite.com/admin/subCategory/index

This what i tried so far and didn't work :

1- adding static rule like this :

'/admin/sub-category' => '/admin/subCategory/index'

2- add module rewriting rules :

 '<module:\w+>/<controller:\w+>/<id:\d+>'=>'<module>/<controller>/view',
                                '<module:\w+>/<controller:\w+>/<action:\w+>/<id:\d+>'=>'<module>/<controller>/<action>',
                                '<module:\w+>/<controller:\w+>/<action:\w+>'=>'<module>/<controller>/<action>',

please let me know if you need more information, thanks in advance.