# Redirect rewrite Help.

**URL:** <https://community.f5.com/t/redirect-rewrite-help/17521>\
**Category:** Technical Forums\
**Tags:** irules, dev, devops, application-delivery\
**Created:** [August 6, 2009, 7:35pm UTC](https://community.f5.com/t/redirect-rewrite-help/17521 "2009-08-06T19:35:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aj\_2549](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Aj\_2549](https://community.f5.com/u/Aj_2549)\
**Post date:** [August 6, 2009, 7:35pm UTC](https://community.f5.com/t/redirect-rewrite-help/17521/1 "2009-08-06T19:35:39Z")

</div>

Under profile TAB I do see redirect reqrite enabled for one VIP matching all.IF someone bypass this rewrite for specific Ip what irule so we need to configure .

Thanks

Ajay

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [August 6, 2009, 9:38pm UTC](https://community.f5.com/t/redirect-rewrite-help/17521/2 "2009-08-06T21:38:14Z")

</div>

Hi Ajay,

You can determine whether rewrite redirects is enabled on a specific HTTP profile using PROFILE::http redirect\_rewrite ([Click here](http://devcentral.f5.com/wiki/default.aspx/iRules/profile__http)), but you cannot modify the configuration using this command. I think you would need to manually implement the rewriting of redirects using an iRule and then not do it for specific IP addresses. There is a Codeshare example from Deb which you could modify to do this:

Rewrite HTTP Redirect Hostname

[http://devcentral.f5.com/wiki/default.aspx/iRules/RewriteHTTPRedirectHostname.html](http://devcentral.f5.com/wiki/default.aspx/iRules/RewriteHTTPRedirectHostname.html)

You’d want to change “[myold.hostname.com](http://myold.hostname.com) [mynew.hostname.com](http://mynew.hostname.com)” to “http:// https://” and then add a check of the client IP address using IP::addr ([Click here](http://devcentral.f5.com/wiki/default.aspx/iRules/IP__client_addr)) or matchclass ([Click here](http://devcentral.f5.com/wiki/default.aspx/iRules/matchclass)) in HTTP\_RESPONSE:

```tcl
when HTTP_RESPONSE { 
  
     Check if server response is a redirect and client IP is not 1.1.1.1 
    if { [HTTP::header is_redirect] and not ([IP::addr [IP::client_addr] equals 1.1.1.1])} { 
  
        Log original and updated values 
       log local0. "Original Location header value: [HTTP::header value Location],\ 
          updated: [string map -nocase {http:// https://} [HTTP::header value Location]]" 
  
        Do the update, replacing "http://" with "https://" 
       HTTP::header replace Location [string map -nocase "http:// https://" [HTTP::header value Location]] 
    } 
 }

```

Aaron
