Skip to content

Commit

Permalink
Merge pull request #61 from tlovett1/bugfix/root-redirect-miss
Browse files Browse the repository at this point in the history
Redirects from '/' not working
  • Loading branch information
tlovett1 committed Aug 12, 2014
2 parents 174c5cb + 0b70935 commit 9b16e36
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion safe-redirect-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,11 @@ public function action_parse_request() {
$requested_path = esc_url_raw( $_SERVER['REQUEST_URI'] );
$requested_path = stripslashes( $requested_path );

$unslashed_requested_path = untrailingslashit( $requested_path );
if ( empty( $unslashed_requested_path ) ){
$unslashed_requested_path = '/';
}

/**
* If WordPress resides in a directory that is not the public root, we have to chop
* the pre-WP path off the requested path.
Expand Down Expand Up @@ -831,7 +836,7 @@ public function action_parse_request() {
if ( $enable_regex ) {
$matched_path = preg_match( '@' . $redirect_from . '@', $requested_path );
} else {
$matched_path = ( untrailingslashit( $requested_path ) == $redirect_from );
$matched_path = ( $unslashed_requested_path == $redirect_from );

// check if the redirect_from ends in a wildcard
if ( !$matched_path && (strrpos( $redirect_from, '*' ) === strlen( $redirect_from ) - 1) ) {
Expand Down

0 comments on commit 9b16e36

Please sign in to comment.