Frontend Backend Url Management

I’m using a Yii folder structure like the one described here http://www.yiiframework.com/wiki/33/organize-directories-for-applications-with-front-end-and-back-end

I forced the admin role check before each request. And it’s ok.

Now i’m facing a problem: if i’m in domain/backend.php and i create a url to “site/contact”, it will go anyway to domain/site/contact and not to domain/backend.php/site/contact.

I’ve found a solution modifing the “rules” array of the “urlManager” component in backend/config/main.php, that’s what:




'urlManager' => array(

            'urlFormat' => 'path',

            'rules' => array(

                'backend.php/<controller:\w+>/<id:\d+>' => '<controller>/view',

                'backend.php/<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

                'backend.php/<controller:\w+>/<action:\w+>' => '<controller>/<action>',

                'backend.php/<view:(about)>' => 'site/page',

                'backend.php/' => 'site/index',

            ),

            'showScriptName' => false,

        ),



It’s working well, but i would like to know from you if it is a good way to use it and if you have a different and solid solution.

Thanks

I’m facing a problem.

I’m using the famouse “user” module. I use it in frontend to register users, and in backend to manage users.

The problem is that if i try to use it in the backend, it works with links like “domain/user/view/150” and not like “domain/backend.php/user/view/150”. It’s necessary to me, because i use a behavior on the “onBeginRequest” to check if a user is logged in as “admin” when it uses the “backend” part of the application.

How could i solve it? How could i use the user module within the "common" module folder, working from the backend and maintaining the backend.php base within the url?

No help guys?