Forum Discussion
irule and redirect exception
we have a domain bankrate.com that redirects all request to , however need to make an exception for a particular URL NOT to redirect. for example: we do not want to redirect http://bankrate.com/filename.html, all other request to http://bankrate.com/* should redirect to http://www.bankrate.com/.
Here's my irule currently:
when HTTP_REQUEST { switch -glob [HTTP::uri] { "/system/util/email.aspx*" { HTTP::respond 301 Location "; } } switch [HTTP::host] { bankrate.com - { HTTP::respond 301 Location "http://www.bankrate.com[HTTP::uri]" } } }
- Charles_LambNimbostratus
iRules are processed in the order in which they are written so if you put your uri exception at the top of the iRule it will be processed before the other redirects.
switch -glob [HTTP::path] { "/filename.html" { pool YOUR_POOL } the rest of your iRule...
- Charles_LambNimbostratus
iRules are processed in the order in which they are written so if you put your uri exception at the top of the iRule it will be processed before the other redirects.
switch -glob [HTTP::path] { "/filename.html" { pool YOUR_POOL } the rest of your iRule...
- Joe_Pena_46781Nimbostratus
thanks Chuck. I'm trying to tell the script not to 301 redirect this url http://bankrate.com/filename.html. The pool is fine.
Currently http://bankrate.com/filename.html will do a 301 redirect to http://www.bankrate.com/filename.html. I need that behavior to stop for that URL only but continue to 301 redirect everything else that comes in
- Charles_LambNimbostratus
Oh I see. You have multiple switch statements so it must process the first until it find a match and then process the next where as if it were all under the same switch statement it would stop processing once it found a match. You may try using if/else instead of switch.
if your_file_name { do something } elseif host_to_redirect { redirect } else { default behavior }
If you did this it would stop process on that particular event once it matched on your file name thereby never redirecting.
- Stanislas_Piro2Cumulonimbus
Hi,
you can use this irule
when HTTP_REQUEST { if {[HTTP::host] equals "bankrate.com"} { if {[HTTP::uri] equals "/filename.html"} { pool MYPOOL } else { HTTP::respond 301 Location "http://www.bankrate.com[HTTP::uri]" } } }
- david_Imer_MortNimbostratus
this is very difficult question ya . i already face this problem in my site: . But after i take the help my Developer friend he give my some solution . here some code you have a try . i don't it works for site or note: Mortgage Agent Toronto. i agree with Stanislas Piron 5726 its works
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