Skip to content
This repository has been archived by the owner on Jan 10, 2021. It is now read-only.

Commit

Permalink
Correcting an issue when resolving the home page URL, namely when a "…
Browse files Browse the repository at this point in the history
…home" page existed under other pages.
  • Loading branch information
Nathan Glasl committed Jun 6, 2016
1 parent 25a41fc commit 4be9503
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [misdirection](https://packagist.org/packages/nglasl/silverstripe-misdirection)

_The current release is **2.2.5**_
_The current release is **2.2.6**_

> A module for SilverStripe which will allow both simple and regular expression link redirections based on customisable mappings, either hooking into a page not found or replacing the default automated URL handling.
Expand Down
5 changes: 3 additions & 2 deletions code/requestfilters/MisdirectionRequestFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ public function postRequest(SS_HTTPRequest $request, SS_HTTPResponse $response,
// Determine the home page URL when replacing the default automated URL handling.

$link = $map->getLink();
if($replace && (strpos(strrev(trim($link, '/')), strrev('home')) === 0)) {
$link = Director::baseURL();
$base = Director::baseURL();
if($replace && (substr($link, 0, strlen($base)) === $base) && (substr($link, strlen($base)) === 'home/')) {
$link = $base;
}

// Update the response using the link mapping redirection.
Expand Down

0 comments on commit 4be9503

Please sign in to comment.