For files that don't actually exist in a "search" directory, this rewrite rule:
RewriteCond /usr/local/apache2/htdocs/search/$1 !-f
RewriteRule /search/(.*) /usr/local/apache2/cgi-bin/s.cgi?$1 [L,T=application/x-httpd-cgi,NE,NC]
allows me to use URLs like this:
http://www.example.com/search/whatever=whatever&something=something
instead of this:
http://www.example.com/cgi-bin/s.cgi?whatever=whatever&something=something
I'm aware of other methods of doing this to separate the query sections removing ampersands and equal signs, but I don't care about that right now. The problem I'm having is with a form which uses "get" instead of "post". The browser address bar is showing this, which probably means s.cgi is getting the question mark sent to it:
http://www.example.com/search/?whatever=whatever&something=something
I need the question mark removed when submitting a form with the "get" method. Again, this rule works perfectly for direct links and forms using post.
Sorry if this is an easy one, but mod_rewrite is not one of my strong points. Also, this is an older version of Apache and mod_rewrite and it cannot handle (?:) style handle back-references.