Forum Discussion
Damion_19248
Nimbostratus
Mar 05, 2013redirect to new domain using a part of the uri
Sample url
http://subdomain.domain.com/1050/38745/productdata-reviews/reviews.htm
301 redirect to
http://domain.com/38745/
The subdomain, the 1050 and the last portion reviews.htm...
nitass
Employee
Mar 05, 2013e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.252:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if { ( [HTTP::host] equals "subdomain.domain.com" ) and
( [scan [HTTP::path] {/1050/%d/productdata-reviews/reviews.htm} num] == 1 ) } {
HTTP::respond 301 noserver Location "http://domain.com/${num}/"
}
}
}
[root@ve10:Active] config curl -I http://subdomain.domain.com/1050/12345/productdata-reviews/reviews.htm
HTTP/1.0 301 Moved Permanently
Location: http://domain.com/12345/
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