Forum Discussion
Want to merge two irules
i am looking to redirect all the traffic which is going to old-domain.com to new-domain.com and also simultaneously i want all the pages,sub pages,menus to be redirected to https...
please advise me on the below
when HTTP_REQUEST { if { [HTTP::host] equals "old-domain.com" } { HTTP::redirect "https://new-domain.com"; return } }
Redirect everything else to HTTPS
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri] }
when HTTP_REQUEST { set uri [HTTP::uri] if { $uri equals "/" or $uri equals "" } { HTTP::redirect "https://[HTTP::host]/irj/portal" HTTP::uri "[HTTP::uri]/irj/portal" log local0. "after is $uri" } }
thanks
- ascherer_304302Nimbostratus
what is the problem ? Does it not work ?
- Zulfeqar_Ahmed_Nimbostratus
Yes it doesn't work,
I need to merge all of them.
Any Ideas,how to do that.
Thanks
- ascherer_304302Nimbostratus
How does it not work because the irules themself look okay to me Do you see an error message ? Is it not redirecting correctly ?
Cheers
- Stanislas_Piro2Cumulonimbus
Hi,
you can try this code:
when HTTP_REQUEST { if { [HTTP::host] equals "old-domain.com" } { HTTP::redirect "https://new-domain.com" } elseif { [HTTP::uri] equals "/" } { HTTP::uri "/irj/portal" } }
For your information, URI never equals "". it always starts with / even if the browser does not display it.
I recommend to redirect to /irj/portal instead of changing URI:
when HTTP_REQUEST { if { [HTTP::host] equals "old-domain.com" } { HTTP::redirect "https://new-domain.com" } elseif { [HTTP::uri] equals "/" } { HTTP::redirect "/irj/portal" } }
Recent Discussions
Related Content
* 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