Forum Discussion
VernonWells
Employee
There are two drawbacks with the use of
string map
, in this case. Firstly, it will replaces all instances of "/mvpvote", even if it happens more than once in the path (or if you're using HTTP::uri
, in the entire length of the Request Target). Secondly, it would replace, for example, "/mvpvote2/" with "2/".
The following solution should be more correct, and as a bonus, better performing (though not tested!):
when HTTP_REQUEST {
switch -glob [HTTP::path] {
"/mvpvote" {
HTTP::respond 301 Location "http://[HTTP::host]/[HTTP::query]"
}
"/mvpvote/*" {
HTTP::respond 301 Location "http://[HTTP::host][substr [HTTP::uri] 8]"
}
}
}
denny_65237
Oct 20, 2016Nimbostratus
Yes,this is more exactly.thank you .I will test it.