Forum Discussion
301 redirection irule
Dear Team,
Currently under Port 80 below irule is configured
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/" { HTTP::redirect "https://[HTTP::host]/XXX.aspx" } } }
Now the requirement is url redirection from 302 to 301
How this can be achieved.
2 Replies
- Kevin_Stewart
Employee
Try this:
when HTTP_REQUEST { if { [HTTP::uri] equals "/" } { HTTP::respond 301 Location "https://[HTTP::host]/XXX.aspx" } }You don't really benefit from a switch if you're only evaluating one thing, and there's no need to do [string tolower ] if you're just checking for "/".
- Kevin_Stewart
Employee
I'm not sure I understand what you're asking. The iRule will force a "301 Moved Permanently" redirect. You're not going to see a 302.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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