Fotios_30046
Sep 14, 2007Nimbostratus
Static 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.