Forum Discussion
Redirect host and path but keep query string on redirect
There's a problem with this, it will redirect to: https://new-domain.com/my-account/web-contact-response.aspx? if there is no query.
Here's what I do:
when HTTP_REQUEST {
if { [string tolower [HTTP::path]] equals "/selfserv/webcontactresponse.aspx" } {
if { [HTTP::query] ne "" }{
HTTP::redirect "https://new-domain.com/my-account/web-contact-response.aspx?[HTTP::query]"
else {
HTTP::redirect "https://new-domain.com/my-account/web-contact-response.aspx"
}
}
I came to this thread wondering if the performance was the same to do:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/selfserv/webcontactresponse.aspx" } {
HTTP::redirect "https://new-domain.com/my-account/web-contact-response.aspx"
elseif { [string tolower [HTTP::path]] equals "/selfserv/webcontactresponse.aspx" } {
HTTP::redirect "https://new-domain.com/my-account/web-contact-response.aspx?[HTTP::query]"
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com