Forum Discussion
iRule
Cirrus
5 years agoMultiple URIs redirect to single URL
Dear Community Experts, I need multiple URIs to be redirected to single URL. Please share iRule that will accomplish this requirement. Following three URIs need to be redirected to https://abc...
- 5 years ago
There are multiple ways to achieve it but would suggest you to add two more conditions in existing iRule.
when HTTP_REQUEST { if { ([HTTP::uri] contains "en/good/morning.aspx") || ([HTTP::uri] contains "en/good/evening.aspx") || ([HTTP::uri] contains "en/good/night.aspx") } { HTTP::redirect "https://abcdef.com" } }Cheers...
Daniel_Wolf
MVP
5 years agoJust my two cents on this one: HTTP::redirect always sends an HTTP 302 (Temporary Redirect) status code. If you want to send a different status code (like HTTP 301 (Permanent Redirect)) should use HTTP::respond instead.
If you use a 302 is used instead of a 301, search engines might continue to index the old URL, and disregard the new one as a duplicate.
iRule
Cirrus
4 years agoHi Daniel,
Thank you for your input.
If I follow your piece of advice then the iRule will be similar to bellow for any future iRule that I create?
- when HTTP_REQUEST {
- if { ([HTTP::uri] contains "en/good/morning.aspx") || ([HTTP::uri] contains "en/good/evening.aspx") || ([HTTP::uri] contains "en/good/night.aspx") } {
- HTTP::respond "https://abcdef.com"
- }
- }