Apache mod_rewrite on Query_String

Note to self: use a RewriteCond against %{QUERY_STRING} to match Query_String arguments in RewriteRule’s. To send requests for http://www.example.com/stuff.jsp?id=2 to another host:

RewriteEngine on
RewriteCond   %{QUERY_STRING} id=2
RewriteRule   ^/stuff.jsp     http://www.acme.com [R,L]

Published by

lekkim

Positive, competent, out-spoken, frank and customer focused architect and developer with a strong foundation in web, cloud and product development. I'm a strong advocate for API first and cloud based solutions and development. I have a knack for being able to communicate and present technically complicated matters in conference, customer and training settings. I've previously acted as team member and leader in a product organisation.