The directory structure of the Yii project site Discussion

I would like to start a discussion re: The directory structure of the Yii project site.

I have setup VHosts (WAMP) and all is working.

My main-local.php file (site and basePath are set identically in backend and frontend):

// uncomment the following to define a path alias

Yii::setPathOfAlias('site', '..' . DIRECTORY_SEPARATOR . '..');

// This is the main Web application configuration. Any writable

// CWebApplication properties can be configured here.

return array(

    'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',

    'name' => 'Matt Skelton',

    // preloading 'log' component

    'preload' => array('log'),

    // autoloading model and component classes

    'import' => array(










You’ll notice that site points to the top-level that contains beackend, frontend, common, & console.

How do I create a link that points to http://backend.localhost/ ?



There is a similar thread here - http://www.yiiframew…p?/topic/17436-

Check the post #9

Thanks but that was my post. I have the VHost setup already but I need to know how to create a url to access the backend. Do I have to hard code it like

<a href="backend.localhost">Admin</a>

or is there a dynamic Yii way to point to sub domains.


Note that there is no need to post the same question in different topics…

As for the backend… again it’s about apache configuration…

You can set an "alias" like:

Alias /administrator /www/htdocs/yourprocjectfolder/backend/www

This way you can access the backend with a link like


Does shared hosts allow you to do this?

You need access to the apache config… that on shared hosting you don’t have

but it all depends on how the server is configured… so you need to check this with the hosting support…

Note: the yiisite is on VPS hosting

thanks :) So it would not be practical to have this kind of directory structure if on a shared host right?..

It depends on your possibilities to make the setup needed… and on your personal preferences…

this structure is good for "bigger" projects/sites… where a team is collaborating on the same project… and where it could be a need to have the backend published on a different server than the frontend…