Forum Discussion
iRule for Secure All The Time Redirect
Hello,
We are trying to implement an iRule to forward all non-secure traffic (via 301) to secure and non-www to wwww
Example:
http to https http://domain.com -> https://www.domain.com http://www.domain.com -> https://www.domain.com http://www.domain.com/category -> https://www.domain.com/category http://domain.com/category -> https://www.domain.com/category
https non-www to https www https://domain.com -> https://www.domain.com https://domain.com/category -> https://www.domain.com/category
Thank you for your help
1 Reply
Hi Joe,
you may try the iRule below as a starting point...
when HTTP_REQUEST { if { [string tolower [HTTP::host]] starts_with "www." } then { HTTP::respond 301 Location "https://[getfield [HTTP::host] ":" 1][HTTP::uri]" } else { HTTP::respond 301 Location "https://www.[getfield [HTTP::host] ":" 1][HTTP::uri]" } }Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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