installation in subdir

hi all!

The application (default created by yii) is located /app directory in site root directory.


index.php located in site root directory.

  1. Main page opened but all styles has wrong path. /css/… instead of /app/css/… how to set right path?

  2. other pages throws an error

"test" is an application name and site root directory. True path of "assets" is /var/www/test/app/assets,

but here is wrong. How to fix it?


create a shortcut for it as you will have to write it a lot of times


 * This is the shortcut to Yii::app()->request->baseUrl

 * If the parameter is given, it will be returned and prefixed with the app baseUrl.

 * @return string


function bu($url=null){

	static $baseUrl;

	if ($baseUrl===null)


	return $url===null ? $baseUrl : $baseUrl.'/'.ltrim($url,'/');


then just use bu(‘myUrl’) that will return subfolder/myUrl


What about second question. Why yii got wrong path to assets?

it doesn’t

actually, it looks under SCRIPT_PATH, that is where your index file is.

make sure the folder exists and is writable, Yii does not auto-create it

all folders exists, permissions fine. If i move index.php in /app it will be works fine without errors. But i need

index.php in root folder and application in /app folder

I see

so you must configure the assets url and path

in config

return array(












Thank you very much!