src/helpers/BaseUrl.php
public static function canonical()
    {
        $params = Yii::getApp()->controller->actionParams;
        $params[0] = Yii::getApp()->controller->getRoute();

        return static::getUrlManager()->createAbsoluteUrl($params);
    }
public static function canonical()
    {
        $params = Yii::getApp()->controller->actionParams;
        $params[0] = Yii::getApp()->controller->getRoute();

        return static::getUrlManager()->createAbsoluteUrl($params);
    }
public static function canonical ( ) { $ params = Yii :: getApp ( ) -> controller -> actionParams ; $ params [ 0 ] = Yii :: getApp ( ) -> controller -> getRoute ( ) ; return static :: getUrlManager ( ) -> createAbsoluteUrl ( $ params ) ; }
Returns the canonical URL of the currently requested page.

The canonical URL is constructed using the current controller's [[\yii\web\Controller::route]] and
[[\yii\web\Controller::actionParams]]. You may use the following code in the layout view to add a link tag
about canonical URL:

```php
$this->registerLinkTag(['rel' => 'canonical', 'href' => Url::canonical()]);
```

@return string the canonical URL of the currently requested page
Returns the canonical URL of the currently requested page .