Community Documentation

A mod_rewrite bug causing occasional corruption of the query string

Last updated November 30, 2009. Created by ivanfi on June 7, 2007.
Edited by LeeHunter. Log in to edit this page.

It seems that using mod_rewrite to set or modify the query string can corrupt it. One case where it certainly fails is if the URL has %2B (a urlencoded "+" character) in it.

As a demonstration, try searching for the string "alice + bob". You can see on http://drupal.org/search/node/alice+%2B+bob that the rewrite rules change the %2B to a space, while on http://drupal.org/?q=search/node/alice+%2B+bob it work correctly without clean URLs.

The reason I am posting it here as a warning and not as a bug report is that it's not a Drupal issue, but a mod_rewrite issue. (It would be worth a bug report for mod_rewrite, but they have such bug reporting guidelines that require a few hours' work to follow...)

Comments

What is the solution for this?

I am encountering this problem. with clean url, words come after first word of a search query are not passed to search functions. without clean url there is no problem. ex:
http://kaosgl.org/?q=search/node/ahmet%20yildiz sents two keys (ahmet and yildiz words) to search func
http://kaosgl.org/search/node/ahmet%20yildiz only sends first key (ahmet) to search func

:-((

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.