I'm using the rewrite_mod to rewrite web service requests. If the QUERY_STRING of the request contains a certain parameter then the URL get some additional parameters. This is my Rewrite Condition. I also use a RewriteMap that defines a key-value pair. When the RewriteCond matchs then the value of the key will be added to the rewritten URL.
That all works fine but now I want to add a default value into the substitution of the RewriteRule in case the RewriteMap cannot find the key in the RewriteMap file. The syntax in the RewriteRule looks like ${ MapName : LookupKey | DefaultValue }
. When the Look-up-Key will not be found the DefaultValue will be used instead.
What I exactly want is that when the key is not found the original request URL will be used and no substitution will be conducted.
My first approaches were to use ${MapName:$1|http://%{HTTP_HOST}%{REQUEST_URI}?{QUERY_STRING}}
or ${MapName:$1|http://%{HTTP_HOST}%{REQUEST_URI}}
but none of it works. I don't know what to put as a DefaultValue after the |
.