• In using Redirection, I notice that the plugin’s not able to differentiate amongst source URLs that share the same beginning. For example:
    Let’s say I set up the following redirects:
    website.com/1 to redirect.com/A
    website.com/10 to redirect.com/B
    website.com/13 to redirect.com/C

    When I enter in any of the source URLs, it reverts to /1 and sends all to redirect.com/A.

    Is there a way to fix this so the redirect differentiates amongst these?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Do you have the regex box checked?

    Thread Starter jpl980

    (@jpl980)

    I do not. I’m assuming that will fix things? Could you briefly explain what the regex option does?

    The regex cheeckbox treats the string as a regex – if you don’t use special regex characters, then it treats it as a sub-string to look for. Which is why I asked.

    But if the checkbox is unchecked, then this would seem to be a bug.

    Thread Starter jpl980

    (@jpl980)

    Definitely unchecked, so definitely a bug then.

    Line 302 in /wp-content/plugins/redirection/models/redirect.php says:

    if (
    	( $this->regex === false && (
    		$this->url === $url || 
    		$this->url === rtrim( $url, '/' ) || 
    		$this->url === urldecode( $url ) 
    		)
    	) || 
    	( $this->regex === true && 
    		@preg_match( '@'.str_replace( '@', '\\@', $this->url ).'@', $url, $matches ) > 0
    	) || 
    	( $this->regex === true && 
    		@preg_match( '@'.str_replace( '@', '\\@', $this->url ).'@', urldecode( $url ), $matches ) > 0
    	) 
    ) {

    So if regex is not set then I cannot see why you should be experiencing your issue.

    NOTE: There is (I think) a bug in this code though not related to the issue above:

    $this->url === rtrim( $url, '/' )

    should I think be:

    rtrim($this->url, '/') === rtrim( $url, '/' )

    Also, I am not sure that this should be an === comparison which is case sensitive or == which is case insensitive – or do you need to lower-case the URL to make a case-insensitive comparison?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Bug- doesn’t differentiate from source URLs that share same beginning’ is closed to new replies.