Forum Discussion
Fotios_30046
Nimbostratus
Sep 14, 2007Static URI Rewrites
Our website search functionality has gone through some heavy modifications recently and in doing so, the url's have been completely rewritten.
To give you a better understanding of whats going on, I'll list the old way and the new way.
www.site.com/common/search/searchcombined.asp?category=XXYYZZ
www.site.com/common/search/searchresult.aspx?categoryid=AABBCC
Additionally, we have a static list of mappings between XXYYZZ and AABBCC that I can populate into a list.
I've gone through the boards and put together the following iRule, but its not working.
class CategoryID
{
"LIGHTING 26"
"BEDROOM 30"
}
when HTTP_REQUEST
{
if {[HTTP::path] == "/searchcombined.asp" }
{
set qstring [HTTP::query]
set CategoryID1 [findstr "category=" [HTTP::query] 7 "&"]
if {$CategoryID1 != ""}
{
set CategoryID2 [findclass $CategoryID1 $::CategoryIDs " "]
if {$CategoryID2 != ""}
{
set qstring [string map [list $CategoryID1 $CategoryID2] $qstring]
}
}
HTTP::respond 301 Location "http://[HTTP::host]/common/search/SearchResult.aspx$qstring"
}
}Any help or suggestions would be great.
11 Replies
- Deb_Allen_18Historic F5 AccountI'd use string map:
set newURI [string map {%20 "" + ""} [HTTP::uri]]
HTH
/deb
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