Forum Discussion
James_Hamoline_
Nimbostratus
Sep 20, 2005301 Redirection via iRule
I currently have an iRule that redirects users. However, HTTP:redirect does a temporary redirect (HTTP Status Code 302). I want a permanent redirect (HTTP Status Code 301).
Here is the iRule:
when HTTP_REQUEST {
HTTP::redirect "http://www.[HTTP::host][HTTP::uri]"
}
Basically, when this iRule runs it tacks on the www.
Does anybody know how I can get this iRule to do a 301 Permanent Redirect?
3 Replies
- You could use the "HTTP::respond" command to send any HTTP response code you want back to the client.
Usage:
HTTP::respond [content ]
Give this a try:when HTTP_REQUEST { HTTP::respond 301 "Location" "http://www.[HTTP::host][HTTP::uri]" }
-Joe - James_Hamoline_
Nimbostratus
Thanks,
That works perfectly. Is there a document that explains the Syntax, commands and object that can be used for iRules? - The documentation currently exists in the BIG-IP Product Documentation. Check out "Configuration Guide for Local Traffic Management (updated 7/25/2005)" on ask.f5.com for documentation on iRules syntax.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects