Forum Discussion
Brandon_11574
Nimbostratus
Mar 24, 2011Rewrite Rule
I am needing to do a URL Rewrite where a visitor requests http://domain.com/newFolder/ but they actually see the content from http://domain.com/oldFolder/
So when they request http://domain....
Brandon_11574
Nimbostratus
Mar 25, 2011Now I'm onto replacing all instances of /oldFolder/ with /newFolder/ in the page content, does this look right?
when HTTP_REQUEST {
switch -glob [ string tolower [HTTP::uri] ] {
"/newFolder/*" {
HTTP::uri [ string map {"newFolder" "oldFolder"} [HTTP::uri] ]
set urlRewrite 1
}
}
}
when HTTP_RESPONSE_DATA {
rewrite the franchise number back to the name in server response
if { $urlRewrite == 1 } {
regsub -all "/Find" [HTTP::payload] "/ReplaceWith" newdata
regsub -all "/368" [HTTP::payload] "/515" newdata
set clen [HTTP::payload length]
HTTP::payload replace 0 $clen $newdata
HTTP::release
}
}
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