Forum Discussion

darrenclegg's avatar
darrenclegg
Icon for Nimbostratus rankNimbostratus
May 14, 2020

Rewrite URL iRule

I have used redirect before and they have worked but can't get this rule to work.

 

When a user browses to abc.co.uk i want to change the URL in the browser bar to www.abc.co.uk. i have tried the following without success:

 

when HTTP_REQUEST {

 if { [HTTP::host] equals "skipton.co.uk/" } {

 HTTP::header replace "Host" "https://www.skipton.co.uk/"

}

}

*with the / on the end

 

when HTTP_REQUEST {

if { [HTTP::host] equals "skipton.co.uk"}

{ HTTP::header replace Host "www.skipton.co.uk"

}

}

*without the / on the end

 

when HTTP_REQUEST { 

if { [HTTP::host] equals "skipton.co.uk" } { 

HTTP::redirect "https://www.skipton.co.uk[HTTP::uri]" 

}

}

 

Can anyone see why it does not work and how to fix it? Much appreciated.