lilbiscuit lilbiscuit - 3 months ago 3x
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.


Yuo can use a simple urlHelper (for absolute url)

use yii\helpers\Url;

echo Url::to(['/'], true );