Forum Moderators: phranque
On one of my sites I have a search box with check boxes that alow the user to choose what database they will search.
I use a script to make this possible. In general you configure the script to point to the search script location and change "search=whatever" to make sure you are sending the corrent variable.
The problem is I need to be able to send 5 variables with one search string
for example...
me.com?q=term&a=foo&b=bar&c=www&d=boo
The script I use to redirect will only accept one variable. I have tried various methods but it simply refuses to let me run more than one variable through it. I think the answer may be through htaccess mod_rewrite.
If I was to use the script to set only the first variable to give an output of...
me.com?q=term
then place an entry in htaccess to redirect
me.com?q=term
to
me.com/?q=term&a=foo&b=bar&c=www&d=boo
To an extent this would work using the following
Redirect?q=(.*)
http*/me.com/?q=(.*)&a=foo&b=bar&c=www&d=boo
But will this create a loop because the url it is redirected to follows the same pattern?
This one is realy making my head bust. Beer for the person who solves it. :)
Mack.
Something like this?
RewriteCond %{QUERY_STRING} ^q=([^&]*)$
RewriteRule (.*) /$1?q=%1&a=foo&b=bar&c=www&d=boo [L]
Jim
It definatly seams to work now. I just need to sort out some syntax at the cgi side of things and i think it will work.
I hate being in a situation where you have more than one variable with more than one script, It's far to easy to loose concentration and get mixed up between the two. lol
Anyway as promised (=) <<beer
Thanks again.
Mack.