When I do
print_r(Yii::app()->request->baseUrl)
I get an empty string. A post on the Yii forum says this is blank by default. How can I change its default value so that I can use absolute URLs?
You can edit /path/to/application/protected/config/main.php to change the default value. Add a request component, and configure baseUrl porperty.
return array(
...
'components' => array(
...
'request' => array(
'baseUrl' => 'http://www.example.com',
),
),
);