I wish to make use of the Apache HTTPd like a proxy server:

If your user demands http://xxx?st=yyy the selected after sales server ought to be server1. If your user demands http://xxx (no st parameter) then your after sales server ought to be server2.

I wish to understand how I have to configure Apache to do this.

Take a look at http://httpd.apache.org/docs/current/mod/mod_rewrite.html and also the good examples particularly you're assisted because:

  • REQUEST_URI The road element of the asked for URI, for example "/index.html". This particularly excludes the query string that is available as since it's own variable named QUERY_STRING.

Which in turn allows you need to do such things as

RewriteCond  %{QUERY_STRING}  ^$
RewriteRule ^/foo/(.*)$ http://server2/$1 [P,L]

RewriteRule ^/foo/(.*)$ http://server1/$1 [P,L]

and so forth. If it's the whole server - remove /foo/ and also the / before $1 - if it's server specific - put an additional RewriteCond before it to limit to some specific host and so forth.