In looking at your code, I see a couple possible of issues that may come up. Mainly with your "if {$CategorID2 != ""}" line. You only set that variable if the CategoryID1 value is found in the query string. What happens if it's not there? CategoryID2 will not get set and you will have a runtime error when trying to evaluate the value against the empty string. Also, if the user is on a keepalive connection, the variables you are setting are session variables so they will be around for the entire session and CategoryID2 could be set from a previous request and CategoryID1 isn't set from the current request.
I'd suggest nesting the CategoryID2 comparison in the previous if to avoid these possible issues.
when HTTP_REQUEST
{
if {[HTTP::path] == "/common/search/SearchCombined.asp"}
{
set CategoryID1 [findstr [HTTP::query] "category=" 9 "&"]
if {$CategoryID1 != ""}
{
set CategoryID2 [findclass $CategoryID1 $::CategoryIDs " "]
if {$CategoryID2 != ""}
{
HTTP::respond 301 Location "http://[HTTP::host]/common/search/SearchResult.asp?CategoryID=$CategoryID2"
}
}
}
}
Make sense?
-Joe