public function findRedirectByPath ($path)
	{
		$redirects = $this->findAllRedirects(true);

		foreach ($redirects as $redirect)
		{
			$to = false;

			if (trim($redirect['uri'], '/') == $path)
				$to = $redirect['to'];

			elseif ($uri = $this->_isRedirectRegex($redirect['uri']))
				if (preg_match($uri, $path))
					$to = preg_replace($uri, $redirect['to'], $path);

			if ($to)
			{
				return [
					'to' => strpos($to, '://') !== false
						? $to
						: UrlHelper::siteUrl($to),
					'type' => $redirect['type'],
				];
			}
		}

		return false;
	}
public function findRedirectByPath ($path)
	{
		$redirects = $this->findAllRedirects(true);

		foreach ($redirects as $redirect)
		{
			$to = false;

			if (trim($redirect['uri'], '/') == $path)
				$to = $redirect['to'];

			elseif ($uri = $this->_isRedirectRegex($redirect['uri']))
				if (preg_match($uri, $path))
					$to = preg_replace($uri, $redirect['to'], $path);

			if ($to)
			{
				return [
					'to' => strpos($to, ':
						? $to
						: UrlHelper::siteUrl($to),
					'type' => $redirect['type'],
				];
			}
		}

		return false;
	}
public function findRedirectByPath ( $ path ) { $ redirects = $ this -> findAllRedirects ( true ) ; foreach ( $ redirects as $ redirect ) { $ to = false ; if ( trim ( $ redirect [ 'uri' ] , '/' ) == $ path ) $ to = $ redirect [ 'to' ] ; elseif ( $ uri = $ this -> _isRedirectRegex ( $ redirect [ 'uri' ] ) ) if ( preg_match ( $ uri , $ path ) ) $ to = preg_replace ( $ uri , $ redirect [ 'to' ] , $ path ) ; if ( $ to ) { return [ 'to' => strpos ( $ to , '://' ) !== false ? $ to : UrlHelper :: siteUrl ( $ to ) , 'type' => $ redirect [ 'type' ] , ] ; } } return false ; }
Finds a redirect matching the given path

@param $path

@return array|bool
@throws \yii\base\Exception
Finds a redirect matching the given path