Forum Discussion
Sami_Sheikh_140
Nimbostratus
Feb 21, 2014Hostname redirect to Subdirectory URL
Hi,
I am looking to create an iRule which would redirect users from: Http://example.com or https://example.com to https://example.com/example1/example.htm.
Currenty I have the F5 Virtual ap...
Rene_C_
Nimbostratus
Feb 25, 2014Well,
the short answer: yes, the F5 can handle it.
the longer answer: Do you want to just redirect any requests from http[s]://example.com/ to https://example.com/example1/example.htm? Or just specific ones?
If you want all requests redirected: Usually you have a virtual-server for http and another one for https.
For the virtual-server for http you could add a new irule containing:
when HTTP_REQUEST {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}
for the virtual-server for https, you could add something like that:
when HTTP_REQUEST {
if { [HTTP::uri] eq "/" } {
HTTP::redirect "/example1/example.htm"
}
}
(Untested, but i guess you get the point)
- Sami_Sheikh_140Feb 26, 2014
Nimbostratus
So I am unsure of what you mean by all requests or specific ones. If I understand what you are trying to say then I would say all requests, basically I could put the forward rule in IIS as well but I don't want to touch the server at all since it is an app server and is very delicate. So basically I have about 6 Virtual servers(3 for HTTP and 3 for HTTPS) for 3 different domains but pointing to the same servers and I would like for instance anybody from outside going to http(s)://example1.com to https://example.com/welcome/welcome.htm and http(s)://example2.com to https://example2.com/welcome/welcome.htm so and so forth. Will those Irule you posted above, can I achieve what I am trying to achieve here? Thanks again Rene - Rene_C_Feb 26, 2014
Nimbostratus
If you assign the first rule to the http - virtuals and the second one to the https-virtuals, this should do what you want.
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
