Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d9cd42

Browse files
author
2manypeople
committed
Routing issue with installation in a sub-directory
ref: #7129
1 parent ae5b94f commit 8d9cd42

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Routing/Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private function resolveParameters(RouteCollection $collection)
9494
foreach ($route->getRequirements() as $name => $value) {
9595
$route->setRequirement($name, $this->resolveString($value));
9696
}
97-
97+
$collection->setPrefix('/'.ltrim($this->resolveString($collection->getPrefix()), '/'));
9898
$route->setPattern($this->resolveString($route->getPattern()));
9999
}
100100
}

src/Symfony/Component/Routing/RouteCollection.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,16 @@ public function getPrefix()
259259
return $this->prefix;
260260
}
261261

262+
/**
263+
* Sets the prefix (used to resolve placeholders).
264+
*
265+
* @param string The prefix
266+
*/
267+
public function setPrefix($prefix)
268+
{
269+
$this->prefix = $prefix;
270+
}
271+
262272
/**
263273
* Returns an array of resources loaded to build this collection.
264274
*

0 commit comments

Comments
 (0)