Yii 1.14 controller from two parts in module produce 404 error

我们两清 提交于 2019-12-10 11:49:24

问题


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.

来源:https://stackoverflow.com/questions/25916671/yii-1-14-controller-from-two-parts-in-module-produce-404-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!