# Https to https redirection

**URL:** <https://community.f5.com/t/https-to-https-redirection/11632>\
**Category:** Technical Forums\
**Tags:** big-ip, irules, application-delivery\
**Created:** [October 11, 2017, 11:06pm UTC](https://community.f5.com/t/https-to-https-redirection/11632 "2017-10-11T23:06:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dassy\_165659](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@Dassy\_165659](https://community.f5.com/u/Dassy_165659)\
**Post date:** [October 11, 2017, 11:06pm UTC](https://community.f5.com/t/https-to-https-redirection/11632/1 "2017-10-11T23:06:13Z")

</div>

Hi All,

I am having trouble to rewrite an iRule in F5 for HTTPS to HTTPS. Here is my current iRULE(see below) and i want to redirect it as [https://xyz.com.au](https://xyz.com.au) to [https://xyz.com](https://xyz.com) .We have certificate installed for \*.xyz.com on the F5. Can anyone please help me here

**Current iRule**

when HTTP\_REQUEST { if { [string tolower [HTTP::host]] equals "; } { HTTP::respond 301 Location "; } }

---

<div class="post-metadata">

**Author:** ![stan\_piron](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@stan\_piron](https://community.f5.com/u/stan_piron)\
**Post date:** [October 12, 2017, 7:11am UTC](https://community.f5.com/t/https-to-https-redirection/11632/2 "2017-10-12T07:11:25Z")

</div>

Hi, the code may work (I removed the semi-colon in if condition)

```tcl
when HTTP_REQUEST { 
    if { [string tolower [HTTP::host]] equals "www.xyz.com.au" } {     
        HTTP::respond 301 Location "https://www.xyz.com";         
    }     
}

```

But as ssl is negotiated before the http request is sent by the browser, you will have an ssl error due to ssl mismatch before redirect.

You must have a certificate for to prevent ssl error. You can then configure SNI to send right certificate based on server name extension.
