Permalink
Browse files

Process preg_replace on redirect_to to account for potential replacem…

…ents when regex is enabled [fixes #37]
  • Loading branch information...
1 parent 5c455fe commit a9ad5bffddf04cc164bc6a60be3796a5330b2f08 Taylor Lovett committed Mar 24, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 safe-redirect-manager.php
@@ -823,6 +823,11 @@ public function action_parse_request() {
header("X-Safe-Redirect-Manager: true");
+ // Allow for regex replacement in $redirect_to
+ if ( $enable_regex ) {
+ $redirect_to = preg_replace( '@' . $redirect_from . '@', $redirect_to, $requested_path );
+ }
+
// if we have a valid status code, then redirect with it
if ( in_array( $status_code, $this->valid_status_codes ) )
wp_safe_redirect( esc_url_raw( $redirect_to ), $status_code );

1 comment on commit a9ad5bf

Owner

tlovett1 commented on a9ad5bf Mar 24, 2013

This needs to be tested more. If anyone could try this out I'd appreciate it.

Please sign in to comment.