Forum Discussion
REDIRCT HOST
Good morning!
i want redirect a host to another host but with the same path, and i have many path!
exmple:
i have this hosts: https://www.abc.com/azer/iiokldf§123/kjiu to https://www.aze.com/azer/iiokldf§123/kjiu
https://www.abc.com/aqs/mkmfljdf/kjflk to https://www.aze.com/aqs/mkmfljdf/kjflk
and if path start with: azqsd i want redirect hem to another host: : https://www.abc.com/azqsd/hkdh/ to https://pqr.com/azqsd/hkdh/
the idea is the redirected the host depending in path, so it is necessary to recover the path!
Do you know how to do it?
Thank you,
best regards,
You can use below iRule to redirect to the mentioned host keeping same URI path. Also if you want to match other condition for URI path like starts with. You can add another elseif statement given below and write iRule. Just you need to change the order of statements according to your use case under if-elseif statements.
if { [HTTP::uri] starts_with "azqsd"} {
HTTP::redirect https://host
when HTTP_REQUEST { if { [HTTP::host] equals "www.abc.com"} { HTTP::redirect "https://www.aze.com[HTTP::uri]" } }
Hope it helps!
Mayur
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