Forum Discussion
Scott_85950
Nov 13, 2010Nimbostratus
Root Domain Redirect Retaining Query String
Hi, I am looking to redirect, hopefully 301 redirect, from the default domain when called to a new home page location while retaining any appended query in the original URI. I have the following i...
nitass
Nov 13, 2010Employee
i a little bit modified rule according to sol9952. pls feel free to revise.
SOL9952: The HTTP::path iRule command may return more information than expected
https://support.f5.com/kb/en-us/solutions/public/9000/900/sol9952.html
virtual bar {
snat automap
pool foo
destination 172.28.17.55:80
ip protocol 6
rules myredirect
profiles {
http {}
tcp {}
}
}
rule myredirect {
when HTTP_REQUEST {
if { [URI::path [HTTP::path]] eq "/" and [HTTP::query] ne ""} {
HTTP::redirect "http://[HTTP::host]/guest/en/home.shtml?[HTTP::query]"
}
}
}
curl -I http://172.28.17.55
HTTP/1.1 200 OK
Date: Sat, 13 Nov 2010 07:28:33 GMT
Server: Apache/2.0.59 (rPath)
Last-Modified: Thu, 11 Nov 2010 04:23:21 GMT
ETag: "1315d-5f-5580a040"
Accept-Ranges: bytes
Content-Length: 95
Content-Type: text/html; charset=UTF-8
curl -I http://172.28.17.55/?s_cid=ThisIsATest
HTTP/1.0 302 Found
Location: http://172.28.17.55/guest/en/home.shtml?s_cid=ThisIsATest
Server: BigIP
Connection: Keep-Alive
Content-Length: 0
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