cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

iRule for HTTP redirect from retired URL to new HTTPS URL

Srinivasan_N
Nimbostratus
Nimbostratus

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 5

Samir
Nacreous
Nacreous

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" } }

 

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..

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.

Thanks for the reply. The confusion around here is, new site "www.newsite.com" isn't managed by our network. This is some external URL, so whether firewall rules are required...?

 

And, once the old URL is retired, hope we're good to remove the public DNS as well..

And to keep you informed, this is not working. I've applied this but no luck 😞