Skip to content

Commit

Permalink
Merge pull request #19 from AlphaRecon19/master
Browse files Browse the repository at this point in the history
Fix jump links
  • Loading branch information
SahAssar committed Aug 21, 2017
2 parents 0449e84 + 46064a6 commit 4a5becd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Redirector/Redirector.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,21 @@ public function __construct(Config $config)
*/
public function handle(Request $request, Application $app)
{

$path = trim($request->getPathInfo(), '/');
foreach ($this->config->getRedirects() as $redirect) {

$redirect->prepare();

if($redirect->match($path)){
return $app->redirect('/' . $redirect->getResult($path), 301);
if ($redirect->match($path)) {
$result = $redirect->getResult($path);

// Only prefix Bolt redirects
if (!preg_match("~^(https?|ftps?)\://~", $result)) {
$result = '/' . $result;
}

return $app->redirect($result, 301);
}
}
}
}
}

0 comments on commit 4a5becd

Please sign in to comment.