31-Mar-2020 01:33
Hello,
I have a domain abc.com new build, i want to redirect all link old or error go to home page, and all the old links have the same structure.
Exam old link: https://test.abc.com.vn/DetailJob.aspx?Mod=search&CatId=21&job=1029042&Lang=vi will be redirect to https://test.abc.com.vn.
I have created an irule as below, but it does not work. Can you help me, please!
when HTTP_REQUEST {
if { [HTTP::host] starts_with "test.abc.com"} {
Pool websitenew
} elseif { [HTTP::host] starts_with "test.abc.com" and [HTTP::uri] ends_with "Lang=vi"} {
HTTP::redirect "https://test.abc.com"
}
}
31-Mar-2020 01:57
Hello,
Bind pool 'websitenew' to the virtual server associated with "test.abc.com" and apply below iRule to same VS.
when HTTP_REQUEST {
if {[string tolower [HTTP::uri]] ends_with "Lang=vi" } {
http::redirect "https://test.abc.com"
}
}
Hope it helps!
Mayur
31-Mar-2020 02:05
hello,
But, i config many site use only IP address. Can you tell me more clearly, Please!
I try:
when HTTP_REQUEST {
if { [HTTP::host] starts_with "test.abc.com"} {
Pool websitenew
} elseif {[string tolower [HTTP::uri]] ends_with "Lang=vi" } {
http::redirect "https://test.abc.com"
}
}
Not working 😞
31-Mar-2020 03:08
So you mean there are multiple application behind one Virtual Server?
Mayur
31-Mar-2020 04:58
Hello Mayur Sutare,
This is currently my irule configuration, can you tell me what I should do to handle the above question?
Thank you !
31-Mar-2020 05:38
So alongwith this iRule, you can also bind below separate iRule on same VS. Just keep this iRule above existing iRule. So it will get match first.
when HTTP_REQUEST {
if {[string tolower [HTTP::uri]] ends_with "Lang=vi" } {
http::redirect "https://test.abc.com"
}
}
Hope it helps!
Mayur
31-Mar-2020 06:02
Hi Mayur,
I don't think so, because some of my sites have the same end. So I want to assign a specific domain test.abc.com.
If I do as you described, it redirects my whole other site?
31-Mar-2020 07:34
yes right. In that case, try below iRule which is specific to host.
when HTTP_REQUEST {
if { [HTTP::host] equals "test.abc.com" and [HTTP::uri] ends_with "Lang=vi" } {
HTTP::redirect "https://test.abc.com"
}
}
Mayur
31-Mar-2020 10:19
Hi Mayur,
It not working for me. You have know a other solution, help me!
01-Apr-2020 02:49
make sure you have new iRule above existing iRule. Also if it is already there, then it seems end statements is not getting matched.
One question here,
is URI 'DetailJob.aspx?Mod=search&CatId=21&job=1029042&Lang=vi' is same all the time?
If yes, then may be you can try below iRule. It is working fine. I've tested it in my lab setup.
when HTTP_REQUEST {
if {[HTTP::host] equals "test.abc.com" and [HTTP::uri] equals "/DetailJob.aspx?Mod=search&CatId=21&job=1029042&Lang=vi"} {
HTTP::redirect "https://test.abc.com"
}
}