Forum Discussion
Redirect www to https
Hi,
I have configured an HTTP VIP and configured irule to redirect all HTTP traffic to HTTPS VIP which I have created. It is working fine as expected. Below are the script which i have used.
when HTTP_REQUEST {
HTTP::redirect "https://[HTTP::host][HTTP::uri]”
}
I want to create another rule when someone try to access http://www.abc.com it should be redirected to https://abc.com i.e. I need to remove the www and also it should be redirected to HTTPS VIP. Is there any way to achieve this.
Thank you,
Ashish R
1 Reply
- Vijay_E
Cirrus
Try this:
when HTTP_REQUEST { if { [HTTP::host] eq "www.abc.com" } { HTTP::redirect "https://abc.com[HTTP::uri]” }
If you are looking for a generic rule, you can try something like this:
when HTTP_REQUEST { if { [HTTP::host] starts_with "www." } { HTTP::redirect "https://[getfield [HTTP::host] "www." 2][HTTP::uri]” }
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com