diff --git a/src/Twig/TwigExtension.php b/src/Twig/TwigExtension.php index 58f3e36a..11db9cc7 100755 --- a/src/Twig/TwigExtension.php +++ b/src/Twig/TwigExtension.php @@ -78,7 +78,9 @@ public function url(string $name, $queryargs = []): string // this is copy of \Slim\Slim::urlFor() // to mix path prefix in \Slim\Slim::urlFor - return rtrim($this->pathPrefix(), '/') . $this->router->urlFor($name) . $query; + $prepend = $this->pathPrefix ?: ''; + + return rtrim($prepend, '/') . $this->router->urlFor($name) . $query; } /**