Forum Discussion
NN
Jun 27, 2023Altostratus
Redirect the domain name on URL, but keep path as the original URI path
Hi All, I'm trying to create an iRule which help me to redirect only the domain name. For example I want to redirect www.example.com/europe/login to www.dr-example.com/europe/login or www.exampl...
- Jun 27, 2023
Hi NN ,
you can do it with this :when HTTP_REQUEST { if { [HTTP::host] equals "www.example.com"} { HTTP::redirect "https://www.dr-example.com[HTTP::path]" } }
using [HTTP::path] >>> Returns your path in each URI.
so if path changed in each request , redirection will happen only on host name and keep the path as it is.
GoodLuck 🙂
Jun 27, 2023
Hi NN ,
you can do it with this :
when HTTP_REQUEST {
if { [HTTP::host] equals "www.example.com"} {
HTTP::redirect "https://www.dr-example.com[HTTP::path]"
}
}
using [HTTP::path] >>> Returns your path in each URI.
so if path changed in each request , redirection will happen only on host name and keep the path as it is.
GoodLuck 🙂
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects