Forum Discussion
scottl_82413
Nimbostratus
Mar 09, 2010Don't redirect particular URI path
We have several old websites that we are migrating away from and a new website that everyone should start using - for this example, we'll call them www.oldsite.com, www.oldsite2.com, www.oldsite3.com and www.newsite.com.
I want to redirect everyone to the new website, unless they are coming in on our test URL, which would be www.oldsite.com/testing (this could have some additional text appended to the end as they move through the site)
Everything else should redirect.
This irule (and about 20 variations) seem to redirect everything:
when HTTP_REQUEST {
if {not ([HTTP::path] starts_with "/testing")}{
HTTP::redirect https://www.newsite.com
}
}
What am I doing wrong?
- hoolio
Cirrostratus
That iRule looks like it should work fine assuming you have it enabled on the oldsite VIP. Can you add logging if it's not working as you expect?when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::path]" if {not ([HTTP::path] starts_with "/testing")}{ log local0. "[IP::client_addr]:[TCP::client_port]: Matched URI check. Redirecting." HTTP::redirect https://www.newsite.com } }
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