Forum Discussion
Carol_Williams_
Nimbostratus
Jun 13, 2006Send a 301 error instead of 302 with redirect
I am using version 4.6.4 and currently have a rule to direct everything coming in without a www to www.sitename.com. I would like to tell F5 to make this a permanently moved(301 error) instead of a temporary moved(302 error). Is there a way to do this with irules?
Here is the Rule:
if (http_host == "mysite.com") {
redirect to "www.mysite.com/%u"
}
else {
use pool mypool
}
Thanks
Carol
4 Replies
- Deb_Allen_18Historic F5 AccountHi Carol -
I know you can use HTTP::respond in v9 to send a 301, but I'm pretty sure there is no way to send anything but the default redirect in v4.
/deb - gbhavanishan_83
Nimbostratus
I have a customer request of which I'm unsure whether it can be done at all or not: I have a URL where it is redirect from http to https . issue: There Application team asking why TES application has 302 redirection instead 301. What would be the impact to change 302 to 301. What are the requirement if we need to redirect to 301
Can u pls advice me for the above task - Eric_St__John
Employee
What version of code are you using? If you are using v9 or newer you can do something like this:when HTTP_REQUEST { HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri] }
301 redirects are to inform search engines that the page has moved permanently. It shouldn't have any huge impact one way or the other(302 or 301) for this.
Eric - Stuart_Feathers
Nimbostratus
That worked perfectly for me, thanks for the sample code Eric!
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
