Forum Discussion
URI Redirect
I thought it would be simple, but i guess i am just too thick.
I need to have a redirect done, only if the URI does not contain a certain URI.
If the URI contains /vss-df, or /vvs-df/appoitnment, etc then there is no redirect. all other URI would redirect to the URL in the irule.
Do not redirect if the URI contains vvs-df
https://website/vvs-df, https://website/vvs-df/appointments, etc
Direct:
https://website/, https://website/
if { ([HTTP::host] contains "<hostname>") }
if { [HTTP::uri]] ne "/vvs-**") } {
HTTP::redirect "<redirect URL>"
}
}
Hello, you were close but equals and ne cannot be used with wildcard
try this
when HTTP_REQUEST
{
if { [HTTP::host] contains "<hostname>" }{
if { !([HTTP::uri] contains "/vvs-df") }{
HTTP::redirect "https://<redirect-URL>"
}
}
}
2 Replies
- Injeyan_Kostas
Cumulonimbus
Hello, you were close but equals and ne cannot be used with wildcard
try this
when HTTP_REQUEST
{
if { [HTTP::host] contains "<hostname>" }{
if { !([HTTP::uri] contains "/vvs-df") }{
HTTP::redirect "https://<redirect-URL>"
}
}
}thank you, i was trying this and it would just redirect regardless
I was trying this if {![HTTP::uri]] starts_with "/vvs-df/") } {
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