Rewrite - mixed queries

My head hurts a the moment…using GET search form, i need to pass $lang and $query to db search results. The form uses:

`<form method=“GET” action=“http://www.website.com/<?php echo $lang ?>/search/” name=“search” id=“search” ">

`

So, i get the string and rewrite…but how to i also include the $lang value?

RewriteCond %{QUERY_STRING} query=([^&]+) RewriteRule ^([a-zA-Z_]+)/search/$ search/%2&lang=$1 [L,R=301,NC] RewriteRule ^([a-zA-Z_]+)/search/(.*)$ results.php?lang=$1&query=$2 [L,NC]

Thanks in advance

barney,

You can, of course, ADD the lang value to the query string (from the path to search) but the easiest way would be to simply make it a hidden field in your form where it would be appended automatically.

As for your mod_rewrite, %2& means NOTHING in a URI (your first RewriteRule set means nothing … to me). Is that just a typo (for %24 which would be assumed to be $, a reserved character, in front of lang)?

Finally, I am very pedantic about abusing trailing slashes as they are intended to signify that the preceding “filename” is a directory rather than a file. Worse, it offsets internal requests for supporting files by one directory level which generally result in 404’s.

Regards,

DK

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.