Using GET parameters with clean urls I have module where I'm creating a custom path in hook_menu. When the user visits this page, they are supposed to be redirected to another site, with GET query parameters attached to the redirect URL. So for instance, if they visit http://mysite.com/site-search?query=blah, we are supposed to redirect them to http://othersite.com/different-path?query=blah. 

However, we have clean URLs enabled; while I can hit the page http://mysite.com/site-search, it gives a page not found when I try to hit http://mysite.com/site-search?query=blah.


  The requested page "/site-search?query=blah" could not be found. 


I tried adding another path for site-search/%, just to get that extra part of the URL, but that didn't work either. 

Am I able to get the URL parameters while using clean URLs?

Edit: Here's the code:


function my_redirect_menu() {
  $items['site_search'] = array(
    'page callback' =&gt; 'my_redirect_redirect',
    'access callback' =&gt; TRUE, 
  );

  // testing to see if this will allow me to capture get parameters
  // in the form http://site.com/site_search/q=blah
  $items['site_search/%'] = array(
    'page callback' =&gt; 'my_redirect_redirect',
    'access callback' =&gt; TRUE, 
  );

  return $items;
}

function my_redirect_redirect() {
  // see if we can get the get paramters
  return "&lt;pre&gt;" . print_r($_SERVER,1) . "&lt;/pre&gt;";
}


Edit 2 In my example, I transcribed the query string in correctly. It looks like it's a conflict between drupal wanting to use ?q= for its menu routing, and our search host URLs also using ?q= for their queries. If I do query=blah, I am able to hit the page.
I use $_GET variables as needed in my clean-url installs without issue. Views uses $_GET variables, too. Drupal uses $_GET['q'] so you don't want to use that ID, but you should be able to do something like:

function my_redirect_menu() {
  $items['site_search'] = array(
    'page callback' =&gt; 'my_redirect_redirect',
    'access callback' =&gt; TRUE, 
    'type' =&gt; MENU_CALLBACK,
  );
  return $items;
}

function my_redirect_redirect() {
  return $_GET['query'];
}


This is working for me locally. The 2nd item you present in hook_menu only matches for /site_search/foo?query=bar so you only want the first. Be sure to set the 'type' property as well.