I see the current approach (with a "Retain query string through redirect" checkbox) quite incomplete (unflexible). It makes sense in case there is a redirect without any query entered. If there is a redirect query, it is quite obvious that it should replace the current (received) query.

But, what about the situation where there is a redirect source query present, but no destination query defined? Would't it be logical to expect that in such cases we don't always want the query to be retained? Meaning that there can be a case where exactly URL with just a certain query should be redirected to some other address, but without any query part?

I believe "Retain query string through redirect" checkbox shouldn't be a general option, but an option attached to each particular redirect (there can however be a general option, but to be used just as a default value...). This way we could have in one environment redirects where the query part is preserved (retained), as well as some others where it is not...

Comments

dave reid’s picture

Could you provide specific examples of a source path, expected redirect, and actual redirect to help me understand what you're asking for?

luti’s picture

For example, we've displayed some (more complex) content based on a query before. Now, we've reduced it to just a few static pages, and created redirects:
From: /page.php?part=1&period=summer => To: /summer_1.php
(we've kept something for summer period)
From: /page.php?part=1&period=automn => To: /other_1.php
From: /page.php?part=1&period=winter => To: /other_1.php
From: /page.php?part=1&period=spring => To: /other_1.php
(we display just an information that nothing much happens in other periods recently...)
From: /page.php?part=2&period=summer => To: /summer_2.php
(something similar for some other activity...)
etc.

On the other hand, we still have some "active" page(s) which were moved (because we have a content in more languages now, or due to any other possible reason...), but we have to keep a query:
From: /some_old_address?part=x&period=y&quantity=z => To: /some_other_new_address?part=x&period=y&quantity=z

While in the last example we want to retain a query, it is sufficient (not needed / used / desired) in the case of some other addresses (first example above). But, we can only select globally weather to always pass it or always not...

drupalninja99’s picture

It doesn't look like we can redirect from '?', meaning 'foo?bar' gets chopped off to just 'foo'. It'd be nice if we could preserve 'foo?bar' bc I use redirect for a lot of migrations and it's a problem bc alot of sites specify the page by the '?' sign so its not good enough to chop it off.

rerooting’s picture

I actually have this working with civicrm query strings and the redirect module.

It works fine with the core menu system display, menu_block module, but strangely enough, superfish doesnt seem to be able to handle it. I'm going to go file something in their issue queue, but it looks like redirect is not having a problem with this as of 7.x-1.x-beta4

rerooting’s picture

Apologies, this is concerning drupal 7's core redirect functionality, not the redirect module.

wylbur’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

Marking this as works as designed.

wylbur’s picture