Sun Java System Web Server - Redirects That Include A Query String

If you have three old URIs for which you wish to return 301 redirects back to the client like the following:

http://xyz.com/page.jsp?type=a
http://xyz.com/page.jsp?type=b
http://xyz.com/page.jsp

And you would like them to respectively send redirects to these URIs:

http://xyz.com/pageA.jsp
http://xyz.com/pageB.jsp
http://xyz.com/anypage.jsp

Then you would need to added the following rules to the obj.conf file:

<If defined $query and $query =~ "type=(.*)" >
NameTrans fn="redirect" uri="$urlhost/page$1.jsp"

</If>

This will catch any query string contains type=VALUE and redirect that to host/pageVALUE.jsp . This allows you to have just one if stanza rather than requiring a new if stanza for each possible match (which, while it works, can quickly grow into a nightmare for a sysadmin to have to manage).