I have a server that will have 2 different types/formats of requests coming in. Both request URL's will start with: http://myredirect.mycompany.com/browse/
. After '/browse/' it will either be a number:
http://myredirect.mycompany.com/browse/12345, it can be any number
or it will be 2 to 4 capital letters followed by a '-' followed by a number:
http://myredirect.mycompany.com/browse/QA-12345
What I want to do redirect to a different URL that's based on the incoming URL. For example:
http://myredirect.mycompany.com/browse/12345 would redirect to http://serverA.mycompany.com/show_item.cgi?12345
and
http://myredirect.mycompany.com/browse/QA-12345 would redirect to http://serverB.mycompany.com/browse/QA-12345
I think what I want is to use an nginx rewrite but I'm not sure how to form. From what I've googled, you can use regex in rewrites so I could use something like
^(/browse/[0-9])?
for the first one. But how do I actually pull that number into the redirect URL? Thanks!