You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@httpd.apache.org by Apache Wiki <wi...@apache.org> on 2015/02/02 09:38:44 UTC

[Httpd Wiki] Update of "RewriteQueryString" by SeanTimmins

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.

The "RewriteQueryString" page has been changed by SeanTimmins:
https://wiki.apache.org/httpd/RewriteQueryString?action=diff&rev1=20&rev2=21

  RewriteRule /path /path?%1other_val%2
  }}}
  
+ === Remove a Single Key/Value ===
+ To remove a single key/value pair from the query string. This example extends the above one by matching any value and removes multiple, consecutive '&' characters.
+ 
+ {{{
+ RewriteCond %{QUERY_STRING}  (.*)(?:^|&)unWantedKey=(?:[^&]*)((?:&|$).*)
+ RewriteCond %1%2 (^|&)([^&].*|$)
+ RewriteRule ^(/path)$ $1?%2
+ }}}
+ 
  === Making the Query String Part of the Path ===
  Take a URL of the form {{{http://example.com/path?var=val}}} and transform it into {{{http://example.com/path/var/val}}}. Note that this particular example will work only for a single var=val pair containing only letters, numbers, and the underscore character.
  

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org