Forum Discussion
Heidi_35827
Nimbostratus
Nov 08, 2011iRule for HTTP redirect from retired URL to new URL
I'm new to iRules and could use some help. I think I have a pretty basic question but I'm not finding the answer after a few searches in DevCentral.
Here is what I'm trying to do....we ha...
Michael_Yates
Nimbostratus
Nov 08, 2011Hi Heidi,
All that you should need is the basic default "http" HTTP Profile in order to apply an iRule to a Virtual Server.
The only thing that HTTPS is adding to your issue is that you can only apply one SSL Profile (which contains the SSL Certificate that the client will receive when they connect to the Virtual Server) per Virtual Server, so these two HTTPS Sites will have to be put on separate Virtual Servers to prevent SSL Certificate Mismatch Errors.
I made the assumption that these sites are not identical. Basically that https://www.oldsite.com/foo/bar/itemlist.html would NOT equal https://www.newsite.com/foo/bar/itemlist.html.
If they are, use the 2nd Example:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "www.oldsite.com" } {
HTTP::respond 301 Location "https://www.newsite.com"
}
}
or
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "www.oldsite.com" } {
HTTP::respond 301 Location "https://www.newsite.com[HTTP::uri]"
}
}
Hope this helps.
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