Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create absolute url on Yii https?

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 ?

like image 455
Mahesh Eu Avatar asked Nov 04 '13 04:11

Mahesh Eu


People also ask

How to make URL in yii2?

For example, you can use the following code to create a URL for the post/view action: use yii\helpers\Url; // Url::to() calls UrlManager::createUrl() to create a URL $url = Url::to(['post/view', 'id' => 100]);

How can I get current URL in Yii?

Yii::app()->request->getUrl() method is used to get current url in Yii framework.

How can I change base URL in Yii?

You can edit /path/to/application/protected/config/main. php to change the default value. Add a request component, and configure baseUrl porperty.


1 Answers

Try this

Yii::app()->createAbsoluteUrl('site/index', array(), 'https');
like image 61
Neophile Avatar answered Nov 15 '22 04:11

Neophile