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...
nitass
Employee
Feb 22, 2014e.g.
config
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar80
ltm virtual bar80 {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
http { }
tcp { }
}
rules {
myrule
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 12
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar443
ltm virtual bar443 {
destination 172.28.24.10:443
ip-protocol tcp
mask 255.255.255.255
pool foo
profiles {
clientssl {
context clientside
}
http { }
tcp { }
}
rules {
myrule
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 13
}
root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule myrule
ltm rule myrule {
when HTTP_REQUEST {
if { [HTTP::host] eq "example.com" and [HTTP::uri] eq "/" } {
HTTP::redirect "https://[HTTP::host]/welcome/welcome.htm"
}
}
}
test
[root@ve11a:Active:In Sync] config curl -I http://172.28.24.10/ -H "Host: example.com"
HTTP/1.0 302 Found
Location: https://example.com/welcome/welcome.htm
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
[root@ve11a:Active:In Sync] config curl -Ik https://172.28.24.10/ -H "Host: example.com"
HTTP/1.0 302 Found
Location: https://example.com/welcome/welcome.htm
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
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