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,...
Sep 18, 2007
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
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