Forum Discussion
mbuk2k_59598
Nimbostratus
Aug 29, 2013Extracting/Removing part of a URI
Hello,
Apologies if this has already been asked, however is it possible to extract part of a URI?
For example; an incoming URL may be:
http://originalurl.com/pages/index.htm/2013/08/15...
nitass
Employee
Aug 29, 2013e.g.
[root@ve11a:Active:Changes Pending] config tmsh list ltm virtual bar
ltm virtual bar {
destination 172.28.20.111: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 23
}
[root@ve11a:Active:Changes Pending] config tmsh list ltm rule myrule
ltm rule myrule {
when HTTP_REQUEST {
if { [HTTP::host] equals "originalurl.com" } {
if { [HTTP::path] starts_with "/pages/index.htm/" } {
HTTP::respond 301 noserver Location "http://newurl.com[string map {/pages/index.htm/ /} [HTTP::uri]]"
}
}
}
}
[root@ve11a:Active:Changes Pending] config curl -I http://172.28.20.111/pages/index.htm/2013/08/15/mypost -H "Host: originalurl.com"
HTTP/1.0 301 Moved Permanently
Location: http://newurl.com/2013/08/15/mypost
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
