Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Form GET question mark breaking mod_rewrite rule

10 views
Skip to first unread message

basicmo...@gmail.com

unread,
Apr 11, 2013, 5:45:24 PM4/11/13
to
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.
0 new messages