How to create absolute url on Yii https?

Mahesh Eu picture Mahesh Eu · Nov 4, 2013 · Viewed 24k times · Source

I am creating a website which runs on https.. But when i create absolute url using

echo    Yii::app()->createAbsoluteUrl('site/index');

it always return http://mydomainname.com/site/index.

my expected output is https://mydomainname.com/site/index.

How can i create a url with https ?

Answer

Neophile picture Neophile · Nov 4, 2013

Try this

Yii::app()->createAbsoluteUrl('site/index', array(), 'https');