My Application is deployed on localhost/upload.
I am using following code to generate relative URL.
Url::to('@web/my_controller/action'); // it returns /upload/my_controller/action
But, I need full URL like this instead: http://localhost/upload/my_controller/action.
Am I missing something?
You should simply use a route :
Url::to(['my_controller/action']);
And if you want an absolute base url :
Url::to(['my_controller/action'], true);
Read more :
http://www.yiiframework.com/doc-2.0/yii-helpers-baseurl.html#to()-detail
http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html#creating-urls