Commit 338bc86e by Alexander Makarov

Fixed absolute URLs in Url::to

parent 67af6bc8
...@@ -76,7 +76,7 @@ class BaseUrl ...@@ -76,7 +76,7 @@ class BaseUrl
} else { } else {
$url = Yii::getAlias($url); $url = Yii::getAlias($url);
if ($url !== '' && ($url[0] === '/' || $url[0] === '#' || strpos($url, '://') || !strncmp($url, './', 2))) { if ($url !== '' && ($url[0] === '/' || $url[0] === '#' || strpos($url, '://') || !strncmp($url, './', 2))) {
return $url; return strpos($url, '://') ? $url : Yii::$app->getRequest()->getHostInfo() . $url;
} else { } else {
$prefix = $absolute ? Yii::$app->getRequest()->getHostInfo() : ''; $prefix = $absolute ? Yii::$app->getRequest()->getHostInfo() : '';
return $prefix . Yii::$app->getRequest()->getBaseUrl() . '/' . $url; return $prefix . Yii::$app->getRequest()->getBaseUrl() . '/' . $url;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment