Forum Discussion
Permanent HTTP => HTTPS iRule
Hello,
We have the following iRule for a site that recently converted to SSL.
if { [string tolower [HTTP::host]] equals "http://cardiosmart.org" } {
HTTP::redirect "https://www.cardiosmart.org"
That rule works perfectly to redirect the traffic. However, it seems search engines are seeing the redirect as temporary (302) and we are being asked to modify the above rule to do a "Permanent" 301 redirect.
Can someone help by telling me how to modify this rule so that various search sites will see it as a permanent redirect? They say this has dramatically reduced the number of "hits" on our site.
Thanks in advance!
Diane
4 Replies
- Michael_Yates
Nimbostratus
Hi dlogsdonmd,
An "HTTP::redirect" is by default a 302 Redirect. Simply replace it with this: HTTP::respond 301 Location "https://www.cardiosmart.org"
With the HTTP::respond you can reply with any HTTP Status code that you want. - dlogsdonmd
Nimbostratus
Thanks Michael...will give that a try now and ask the team to test. - Christopher_Boo
Cirrostratus
Thanks for posting this! I had never given it a thought, but sure enough my redirects return 302. We like search engine hits, so I'll be fixing this shortly.
Chris - dlogsdonmd
Nimbostratus
Michael that worked...once I applied it to the correct iRule. :) Now hopefully our site hits will go back up where they were pre-https.
Thanks very much!
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