try variants without query string when redirect lookup fails #5

merged 2 commits into from Aug 31, 2012


None yet

3 participants


This is quite similar to the pull request at , except we don't look at PATH_INFO.

There are cases when requests arrive with additional junk in the query string which interferes with finding the redirect. For instance, we want to define a redirect "/some-old-address/" to point to another page or path, but we don't want this to fail when somebody clicks a link that has "/some-old-address/?google=analytics&tracking=junk&and=other&irrelevant=parameters". So here we first try the path as is, then do the test without a trailing slash (as currently), and then try slashed and slashless variants without the query string. There's also a test included.

Sorry for the weirdness with whitespace in the diff. I tried to squash some commits and something odd happened.


Looks good, thanks for this!

@andrewschoen andrewschoen merged commit 95584ff into salvaorenick:master Aug 31, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment