11-Sep-2020 05:19
Hi,
i need help to redirect:
https://www.abc.com/App/Topics/Topic.aspx?TopicId=* redirect to https://abc.com/redirect-legacy/abc-topics/Topic.aspx?TopicID=*
the below are two examples:
https://www.abc.com/App/Topics/Topic.aspx?TopicId=87
should go to
https://abc.com/redirect-tolegacy/abc-topics/Topic.aspx?TopicID=87
https://www.abc.gov/App/Topics/Topic.aspx?topicid=121
should go to
https://abc.com/redirect-tolegacy/abc-topics/Topic.aspx?TopicID=121
My below irule with string map is not working correctly.
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] eq "www.abc.com") and ( [HTTP::uri] starts_with "/App/Topics/Topic.aspx?")} {
HTTP::respond 301 noserver Location "https://www.abc.com[string map {/App/Topics/ /redirect-tolegacy/abc-topics/} [HTTP::uri]]"
}
}
Any help i appreciate.
Thanks
11-Sep-2020 06:28
Hi Hien Truong,
Does redirected uri's hostname contains "www"?
Can you try this?
when HTTP_REQUEST {
if { [HTTP::host] equals "www.abc.com" and [string tolower [HTTP::path]] equals "/app/topics/topic.aspx"} {
HTTP::respond 301 noserver Location "https://www.abc.com/redirect-tolegacy/abc-topics/Topic.aspx?[HTTP::query]"
}
}
11-Sep-2020 08:05
Thanks for your reply. The above irule is not working as expect since when we enter "TopicId=87" the output should be "TopicID=87". it mean when user type TopicId=* will ouput TopicID=*
For example:
https://www.abc.com/App/Topics/Topic.aspx?TopicId=87
should go to
https://www.abc.com/redirect-tolegacy/abc-topics/Topic.aspx?TopicID=87
or
https://www.abc.com/App/Topics/Topic.aspx?TopicId=1000
should go to
https://www.abc.com/redirect-tolegacy/abc-topics/Topic.aspx?TopicID=1000
11-Sep-2020 08:19
when HTTP_REQUEST {
if { [HTTP::host] equals "www.abc.com" and [string tolower [HTTP::path]] equals "/app/topics/topic.aspx"} {
HTTP::respond 301 noserver Location "https://www.abc.com/redirect-tolegacy/abc-topics/Topic.aspx?TopicID=[URI::query [HTTP::uri] TopicId]"
}
}