lilbiscuit lilbiscuit - 1 year ago 126
PHP Question

Yii2 web url without using setAlias

I have a Yii2 app but no ability to edit the config files to utilize setAlias.

If my domain is, and my Yii application is in

directory, then what would be the Yii command to return the following string:



Many posts exist but all I've found is suggestions either based on Yii1 or using setAlias in application config.

Answer Source

Yuo can use a simple urlHelper (for absolute url)

use yii\helpers\Url;

echo Url::to(['/'], true );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download