www.bbb.com/nnn they want to append that to the https://bbb.com/yyy/nnn got the basic syntax just cannot seem to figure out how to add the uri to the redirects uri for anything after the /yyy.
I don’t think user-agents will include anchors in the request sent to the web app. The browser should make a request using the URI minus the anchor and then use the anchor to go to a specific section in the page. You can test this by logging the HTTP::uri value for a request like https://www.example.com/xyx/trackingid=8888 and see if the URI is logged as / or /xyx/trackingid=8888.
In concept though, you can send a 301 redirect using:
the issue is that the /xyx is a;ready part of ther uri that I need to redirect to which I have to set on the lb then I need to add to it from whatever the user types as the uri after the www.example.com
basically not sure how to do this if it can be done
so if user a types www.example.com he needs to get redirected via 301
It sounds like all you’re trying to do is redirect to a second host name, preserving the URI, but making sure that no matter what the URI was, it starts with /xyz/ first. Your concern is that you don’t want to end up with a URI that starts with /xyz/xyz/, right? A simple if clause will solve that problem for you.
So I think what you’re looking for is something like:
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/xyz" } {
HTTP::redirect "http://example2.com[HTTP::uri]"
} else {
HTTP::redirect "http://example2.com/xyz[HTTP::uri]"
}
}
Does that sound about right? If I missed something, let me know.