Closed (fixed)
Project:
Path redirect
Version:
6.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
6 Oct 2010 at 16:58 UTC
Updated:
15 Dec 2010 at 01:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
dave reidTry without the trailing slash (
wordpress?feed=rss2). Also, if these paths currently exist and are actually valid wordpress paths, we can't do anything about it.Comment #2
sansui commentedThe paths don't exist on this server - they're from an old server. I also have a redirect for just "wordpress" which redirects to "blog". Every redirect that has wordpress in it seems to just redirect to the main "blog" page. Any idea what's happening there?
Comment #3
sansui commentedAh... removing that redirect fixed it and I was able to get the other redirects working. Hrmm.. but now how do I redirect just "wordpress"? ;(
Comment #4
jack.r.abbit commentedAh... I am having the same issue. I have a main page "something.asp" and it has some sub pages "something.asp?tab=1" and "something.asp?tab=2". I set up redirects for all three of them to different URLs but they all redirect to the URL for "something.asp". I'm not sure why it "fails". Perhaps it is matching the first one and quits looking for the one that matches the query string. Is this a bug?
Comment #5
jack.r.abbit commentedI believe the logic in path_redirect_compare_array() is a little backwards. The function accepts two parameters: $match and $haystack where $match is the query string from the database and $haystack is the query string from the original URL.
So path_redirect_compare_array() is called repeatedly with the results of $redirects = path_redirect_load_multiple(). But if $redirects contains a redirect without a query string then when path_redirect_compare_array() gets called, it gets passed an empty $match array which will never get looped through in the function so it will return a TRUE... even if another redirect had matching query parameter. I think if you switch the two arrays (loop through $haystack and compare it to $match) then the logic will work out.
Comment #6
jack.r.abbit commented@Sansui ~ Since the redirects are evaluated in the order they are entered, you can always enter the one without the "?" last. It will be at the bottom of the list so the others have a chance to get picked first. Not ideal but it works.
Comment #7
sansui commentedThanks for the tip jack :) I think by serendipity it eventually ended up that way in my configuration, as I noticed the main redirect began working (probably after deleting and readding it at some point, putting it at the end of the redirects).
I'm sure there are others that will benefit from seeing that tip posted too :D
Comment #8
dave reidOk looking into this not being able to handle this properly...
Comment #9
dave reidAlrighty, here's the backport of the improvements I've done to selecting a redirect by source from the Redirect module for Drupal 7 which should fix this bug. Even added tests that with the bug fix part reverted, confirms I get 1 error. Tested and patched against 6.x-1.x-dev.
Comment #10
dave reidRevised patch after testing changes were committed.
Comment #11
dave reidOk I feel good about #10 so I committed it to CVS. http://drupal.org/cvs?commit=457704
Would be great if everyone having this problem could re-check the 6.x-1.x-dev version in about 12 hours and re-confirm that it's fixed for you as well.