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 12, 2013e.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
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