Forum Moderators: phranque
RewriteCond /usr/local/apache/htdocs/search/$1 !-f
RewriteRule /search/(.*) /usr/local/apache/cgi-bin/s.cgi?$1 [L,T=application/x-httpd-cgi,NE,NC] http://www.example.com/search/whatever=whatever&something=something http://www.example.com/cgi-bin/s.cgi?whatever=whatever&something=something http://www.example.com/search/?whatever=whatever&something=something [edited by: bill at 9:00 am (utc) on Apr 17, 2013]
[edit reason] disable smilies [/edit]
RewriteRule /search/(.*) /usr/local/apache/cgi-bin/s.cgi?$1 [L,T=application/x-httpd-cgi,NE,NC]
...
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
URIs include components and subcomponents that are delimited by characters in the "reserved" set. These characters are called "reserved" because they may (or may not) be defined as delimiters by the generic syntax, by each scheme-specific syntax, or by the implementation-specific syntax of a URI's dereferencing algorithm. If data for a URI component would conflict with a reserved character's purpose as a delimiter, then the conflicting data must be percent-encoded before the URI is formed.
non-capturing groupings aren't supported.
I need a rewrite rule that will handle both of these GET requests:
<snip>
without redirection
The two inputs you show are fundamentally different, meaning two different URLs for the same page. Are you in a position where Duplicate Content will not be a problem? Most likely situation: all this is happening in non-indexed search-result pages. Otherwise we're getting into "Just show him how to aim the gun" territory ;)
without it, the script source gets output instead of executed
redirect search/?whatever to search/whatever
RewriteCond %{QUERY_STRING} (.+)
RewriteRule ^/search/$ http://www.example.com/search/%1? [R=301 et cetera]