Forum Discussion
Redirect irule from second field
Hi Thicardoso21,
[HTTP::uri]
Returns or sets the URI part of the HTTP request.
https://clouddocs.f5.com/api/irules/HTTP__uri.html
[HTTP::path]
Returns or sets the path part of the HTTP request. The path is defined as the path and filename in a request. It does not include the query string.
https://clouddocs.f5.com/api/irules/HTTP__path.html
[HTTP::query]
Returns the query part of the HTTP request. The query is defined as the part of the request past a ? character, if any.
https://clouddocs.f5.com/api/irules/HTTP__query.html
[HTTP::host]
Returns the value contained in the Host header of an HTTP request.
https://clouddocs.f5.com/api/irules/HTTP__host.html
For the following URL:
https://mysite.com/content1/anythingelse.html?a=123
[HTTP::uri] : /content1/anythingelse.html?a=123
[HTTP::path] : /content1/anythingelse.html
[HTTP::query] : a=123
[HTTP::host] : mysite.com
iRule:
when HTTP_REQUEST {
if { ([HTTP::host] eq "mysite.com" or [HTTP::host] eq "www.mysite.com") and [HTTP::uri] starts_with "/content1/"} {
HTTP::redirect https://newsite.com/[string map {"/content1/" "/"} [HTTP::uri]]
return
}
}
Hi Enes_Afsin_Al
Thanks a lot for explanaition and sharing those helpful links. I will certaily read them to have a better understanding.
I will be able to test this next week. I will try your suggestion and let you now.
Thank you.
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