Forum Discussion
Chenco_322726
Nimbostratus
Apr 11, 2018Redirect specifc URI to another URL
Hello, I tried to find on google but nothing matched my search. I need a simple redirect from only to > https://www.anotherdomain.com/test/event/841/seatplan/
Any suggestions ? Thanks!
- iaine
Nacreous
Hi
It could be as simple as this
when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "www.domain.com")}{ if {[string tolower [HTTP::uri]] eq "/tickets/841" } { HTTP::redirect "https://www.anotherdomain.com/test/event/841/seatplan/" } } }
However, if your VIP is only hosting content from then you could omit the domain validation part. Also, again depending on your setup, you might want to include some redirect loop config if it is needed
- youssef1
Cumulonimbus
Hello,
You can use this irule no matter the number of the ticket. the ticket number can be dynamic and I think it's your need.
when HTTP_REQUEST { set hostname [string tolower [HTTP::host]] set uri [string tolower [HTTP::uri]] if {$host eq "www.domain.com" && $uri starts_with "/tickets/" }{ set numberticket [string range $uri 9 end] set redirecturi "/test/event/$numberticket/seatplan/" HTTP::redirect "https://www.anotherdomain.com$redirecturi" } }
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