Forum Discussion
Derrick_85757
Nimbostratus
Aug 26, 2008Webpage redirection
I am a newbie to iRules so pardon my stupidity. I have a client that requested a http to https redirection for a website. I created the http VS and https VS and applied the iRule for redirection. T...
hoolio
Cirrostratus
Aug 26, 2008Hi there,
If you want to redirect all requests to the HTTP VIP to an https domain with the original URI, you can use a rule like this:
when HTTP_REQUEST {
HTTP::redirect https://newsite.example.com[HTTP::uri]
}
If you want to redirect to different domains based on the requested domain, you could use a switch statement (Click here😞
when HTTP_REQUEST {
Check the Host header value (set to lower case and using wildcard matching)
switch -glob [string tolower [HTTP::host]] {
"*.example.com" {
HTTP::redirect https://newsite.example.com[HTTP::uri]
}
"*.example2.com" {
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
default {
HTTP::redirect https://newsite2.example.com
}
}
Aaron
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