Forum Discussion
jirish5563_3502
Nimbostratus
Jan 29, 2018Rewrite URL (301) when matches a certain condition
I want to forward traffic from my old site to my new one. They are not in the same data center so this might make it a bit more challenging.
DNS is going to be updated so that "; will get sent t...
jirish5563_3502
Nimbostratus
Jan 30, 2018I was able to figure out part of the issue. The reason the iRule was not working was caused by the SSL Certificate. One site would have to redirect to the other and then the 301 can rewrite the URL. Because both of the Certs don't live on the F5 that was at least part of the issue.
The Rule that I setup, and is working, looks like this:
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] equals "abc.def.com"}
{
HTTP::redirect "https://zyx.wuv.com[HTTP::uri]"
}
}
- Hannes_RappJan 31, 2018
Nimbostratus
Sweet. FYI,
function only does 302 redirects. For 301, you must useHTTP:redirectHTTP::respond 301 Location "foo"
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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