Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to run a Yii application placed in a subfolder of the root:

-> public_html
----> yii_app
--------> index.php
--------> .htaccess
--------> protected
etc..

The application runs fine with url: http://www.site.com/yii_app However, deeper controllers and actions redirect me to http://www.site.com For example: http://www.site.com/yii_app/controller1/action1 will show the home page of the site.

I tried to put in the root .htaccess file rules that ignore the folder yii_app but didn't solve the problem.

RewriteEngine on    
RewriteCond %{REQUEST_URI} "/yii_app/"
RewriteRule (.*) $1 [L]

Any suggestions?

Would really appreciate your help.

Thanks.

share|improve this question
I think you have to use creating url to create work urk, check this: yiiframework.com/doc/guide/1.1/en/topics.url#creating-urls – Abudayah May 28 at 8:12

2 Answers

You forgot to set basePath in your config:

<?php
return array(
    'basePath' => 'yii_app',
    ....
);
share|improve this answer
I tried but gave the following error: Fatal error: Uncaught exception 'CException' with message 'Application base path "yii_app" is not a valid directory.' basePath value was set to dirname(FILE) . DIRECTORY_SEPARATOR . '..', – TechMafioso May 27 at 12:12
'basePath' => 'yii_app/protected',

Almost universal setting for basePath

'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
share|improve this answer
That's what I currently have in the main.php config file. However any deeper controllers and their actions take me back to the homepage. The only working controller/action is the one I set as the default. – TechMafioso May 29 at 9:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.