The attached patch adds an option within the Advanced fieldset to make the redirect case insensitive so it behaves like Apache mod_rewrite's [NC] flag.

Comments

jcarnett’s picture

I just remembered that MySQL string comparisons are case-insensitive by default, so this is really only applicable to PostgreSQL folks.

I suppose that leads to another question then: should the path lookups be done in a case-sensitive manner in MySQL? I think initially I compared this module to Apache redirects which are case sensitive, but I'd like to know what everyone else thinks.

dave reid’s picture

I don't see any reason why we should be allowing case-sensitive redirections. Let's make the default behavior case-insensitive.

dave reid’s picture

Version: 6.x-1.0-beta4 » 6.x-1.x-dev
Status: Needs review » Needs work

Will need a re-roll.

wim leers’s picture

Status: Needs work » Closed (duplicate)

See #973700: Make redirects case sensitive, starting from follow-up #4.

jack.r.abbit’s picture

Status: Closed (duplicate) » Needs work

Why is this closed as a duplicate when the other one came after this one and the patch here is much more comprehensive than the patch over at the newer one?

We ran into an issue where the redirects were failing because some of the parameters being passed were of difference case. I just went in and hacked one line of code to fix that where it loops through the query string array. My issue certainly would not have been fixed with that other patch. I do believe it would if this one is updated.

Also, I think options are good and would like to see it a configurable options.

wim leers’s picture

@jack.r.abbit (cool nickname btw :P) My apologies, I simply hadn't noticed the patch! I agree with what you're saying. Could you maybe post a re-roll so we can move this forward?

jack.r.abbit’s picture

Status: Needs work » Needs review

OK... re-rolled the original patch to work against the current 6.x-1.x-dev (which is the same as 6.x-1.0-rc1, both from 2010-Oct-07).

I don't know what version of code the original patch was against but a lot of it didn't match the current version. It adds the advanced option like the original but defaults it to checked. But I also employed the "binary" query method from Wim Leers' patch referenced in #4.

So there are two places that case comes into play:
1) When pulling from the database, we need to conditionally check the case of the source path. However, if there is a query, it does not get examined here.
2) If there is a query, the values get compared elsewhere so the compare function now accept a a 3rd param to indicate to ignore case.

Both places trigger off the same "ignore_case" flag. One could argue that these could be two separate flags but I didn't see the need. It would be easy enough to split those if needed though.

jack.r.abbit’s picture

StatusFileSize
new4.99 KB

strange... the patch didn't attach the first time.

Status: Needs review » Needs work

The last submitted patch, path_redirect.ignore_case.patch, failed testing.

jack.r.abbit’s picture

StatusFileSize
new5.13 KB

My bad for not thinking about other use cases for the compare array function. Let's see if this one gets by the tests.

jack.r.abbit’s picture

Status: Needs work » Needs review
StatusFileSize
new5.13 KB

bah... I wish I could delete my own comments since I keep messing up what I want to do.
Again... with a smile :)

jack.r.abbit’s picture

I give up. Not sure why the attached patch is being ignored. Give it a try if you want to. Would love to see this functionality built in.

wim leers’s picture

I just noticed http://drupal.org/cvs?commit=459664. I don't think this fixes the problem.

Status: Needs review » Needs work

The last submitted patch, path_redirect.ignore_case.patch, failed testing.

nicholas.alipaz’s picture

This is a pretty big issue for path redirects IMO. I mean say I direct a url like:
v42/index.cvn?id=10023
to
new-page
but that url was also accessible via:
v42/index.cvn?ID=10023
and other variations, then the url becomes inaccessible where linked differently.

I think we are going to have to go the route of adding mod_speling to our server and forcing urls to lowercase before they hit path redirect.

freelock’s picture

Hmm. Definitely something needs to be committed here -- the current 6.x-1.0-rc2 module won't let you save two redirects that only vary by case -- and yet it does a case-sensitive redirect.

We definitely want case-insensitive redirects.

But reviewing the patch, I don't think this will work in Postgres -- LIKE is case-sensitive in postgres (and to comment #1 above, MySQL is case sensitive with =).