Forum Discussion

Sri_Narasimha_11's avatar
Sri_Narasimha_11
Icon for Altostratus rankAltostratus
Feb 28, 2020

iRule for HTTP redirect from retired URL to new HTTPS URL

Hi Experts,

 

I'm new to F5 and could someone please help.  Here is what I'm trying to accomplish...

We have a web site that is retiring and will be replaced with a new site. We would like to do an Http redirect (301) to the new site when someone hits the old URL.

We want the URL in the users address bar to change to the new address. The existing URL is HTTP but the new URL is HTTPS (some external URL).

 

Basic functionality: User goes to http://www.oldsite.com. Redirect is sent to send user to https://www.newsite.com

 

Can you guys please assist.. Thanks in advance.

5 Replies

  • Try this iRule. It will work per your requirement. Let us know if any question

    when HTTP_REQUEST {
    	if { [HTTP::host] equals "www.oldsite.com" } {
    		HTTP::redirect "https://www.newsite.com"
    	}
    }
    • Sri_Narasimha_11's avatar
      Sri_Narasimha_11
      Icon for Altostratus rankAltostratus

      Thanks Samir, Hope this is Permanent re-direct (301).

       

      And please be informed, the new URL is external public URL and hope no extra config required at the F5 or firewall rules..

      • Samir's avatar
        Samir
        Icon for MVP rankMVP

        Above irule will redirected traffic if any user access "www.oldsite.com" but again you need enable firewall rule for new site "www.newsite.com".

         

        Will suggest you check the access "www.newsite.com" in browser before placing irule else will not work.