Forum Discussion
Please try below
when HTTP_REQUEST { if { [string tolower [HTTP::host]] contains "abc.bbc.com" and [string tolower [HTTP::uri]] equals "/"} { HTTP::redirect https://abc.bbc.com/mydirectory/ } }
- Stanislas_Piro2Jul 06, 2017Cumulonimbus
NAG zzz
I think this code will help Ashu, but there is no need to convert uri to lowercase to compare it with / . lowercase and uppercase of / is still / 🙂
when HTTP_REQUEST { if { [string tolower [HTTP::host]] contains "abc.bbc.com" and [HTTP::uri] equals "/"} { HTTP::redirect /mydirectory/ } }
@Ashu, don't use the same irule on both virtual servers.
- on HTTP VS, use the default sys_https_redirect
- on HTTPS VS use this irule
You will have 2 redirect if user requests http://abc.bbc.com/ but transparent for user.
- nag_54823Jul 06, 2017Cirrostratus
my bad Stanislas. Thank for pointing out :)
- Ashu_2116Jul 06, 2017Nimbostratus
Thanks a lot Stanislas Piron !! The i-rule is working like a charm. Thanks again for your help !!
I have 3 more urls hosted on same webserver and they also require similar redirection. Can these other three urls redirections be clubbed into this i-rule or i have to write a separate i-rule for each of them ?
def.bbc.com points to https://def.bbc.com/yourdirectory ghi.bbc.com points to https://ghi.bbc.com/newdirectory jkl.bbc.com points to https://jkl.bbc.com/olddirectory
Also May i ask the difference between your code and my code? It will help me understanding & learning the i-rule code and future i-rule writing.