EDIT (a solution): In the end, the problem wasn't with yii configuration or with the virtual server, but with the main server. I contacted the server administrator and the issue was solved by changing the URL to which the main server (where mi virtual server is hosted into) redirects the requests, to append the string containing the virtual folder's name.
I'm not sure if this was the best solution, but it's a solution. So if you face a similar problem, you might want to contact your server administrator.
Here's the detail of the original problem and some of the options I tried, just for reference:
I've been developing a Yii application for a couple of weeks, and it works perfectly on my local server, but I'm having some troubles to make the URLs work properly when deploying the app.
In the server, I have an structure similar to this:
/www/MyApp/(index.php, protected folder, etc)
/www/yii (the framework is located here)
And I can access my website using an URL like this:
www.somedomain.ac/VirtualFolder/MyApp
My problem is that all the links generated by yii are pointed to (for example):
www.somedomain.ac/MyApp/index.php?r=controller/index
instead of
www.somedomain.ac/VirtualFolder/MyApp/index.php?r=controller/index
I tried modifying the urlManager section at the configuration, and for some reason adding these rules:
'../../VirtualFolder/MyApp/index.php/'.'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'../../VirtualFolder/MyApp/index.php/'.'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
make some of the builded URLs point to the proper action, with the complete URL, but still, other ones won't work (all the ones that send a form to the server).
I've been trying other solutions to similar problems during a couple of days (like changing the app's basepath, adding "VirtualFolder" to it) but they don't seem to work.
Suggestions on how to solve the problem will be very appreciated.
Thanks.
============================================
EDIT: I am trying to do it with an .htaccess file like this:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} somedomain.ac$ [NC]
RewriteCond %{HTTP_HOST} !VirtualFolder
RewriteRule ^(.*)$ http://somedomain.ac/VirtualFolder/$1 [R=301,L]
And I copied it to my web root, but not working yet. Also tried copying it to MyApp/protected folder and directly into MyApp. Am I missing something?
Thanks.