Forum Discussion
nitass
Mar 13, 2013Employee
e.g.
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
if { [HTTP::host] equals "subdomain.domain.com" } {
if { [HTTP::path] ends_with "reviews.htm" } {
if { [scan [HTTP::path] {/%*d/%d/%*s} num] == 1 } {
HTTP::respond 301 noserver Location "http://www.domain.com/${num}/"
}
} elseif { [HTTP::path] ends_with "category.htm" } {
if { [scan [HTTP::path] {/%*d/%*d/%[^/]/%*s} str] == 1 } {
HTTP::respond 301 noserver Location "http://www.domain.com/[string map {"-reviews" ""} $str]/"
}
}
}
}
}
[root@ve10:Active] config curl -I http://subdomain.domain.com/1050/38745/productdata-reviews/reviews.htm
HTTP/1.0 301 Moved Permanently
Location: http://www.domain.com/38745/
Connection: Keep-Alive
Content-Length: 0
[root@ve10:Active] config curl -I http://subdomain.domain.com/1050/38745/productdata-reviews/category.htm
HTTP/1.0 301 Moved Permanently
Location: http://www.domain.com/productdata/
Connection: Keep-Alive
Content-Length: 0
[root@ve10:Active] config curl -I http://subdomain.domain.com/1050/38745/productdata-moredata-reviews/category.htm
HTTP/1.0 301 Moved Permanently
Location: http://www.domain.com/productdata-moredata/
Connection: Keep-Alive
Content-Length: 0