src/Helpers/Request/UrlHelper.php
public function canonical()
    {
        $routePath = $this->getCurrentPath(true);
        if ($routePath === null) {
            return null;
        }
        $params = $this->app->getRoute()->getRouteParams();
        $params[0] = $routePath;

        return $this->getUrlManager()->createAbsoluteUrl($params);
    }
public function canonical()
    {
        $routePath = $this->getCurrentPath(true);
        if ($routePath === null) {
            return null;
        }
        $params = $this->app->getRoute()->getRouteParams();
        $params[0] = $routePath;

        return $this->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
@see \Reaction\Helpers\Url::canonical()