Forum Discussion

dlogsdonmd's avatar
dlogsdonmd
Icon for Nimbostratus rankNimbostratus
Mar 14, 2013

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

  • 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.
  • Thanks Michael...will give that a try now and ask the team to test.

     

  • 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
  • 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!