Forum Discussion
Ryan_McDonald_8
Nimbostratus
Aug 07, 2009Redirect to www
If a customer types in domainname.com I want them to be redirected to www.domainname.com.
I used the irule generator and came up with this
when HTTP_REQUEST {
if {...
Ryan_McDonald_8
Nimbostratus
Aug 12, 2009I was able to get the second rule to work with one minor change. (It wasn't redirecting http://www.scadalynx.com to https://www.scadalynx.com)
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] eq "domainname.com" } {
if {[TCP::local_port] == 443 } {
HTTP::redirect "https://www.[HTTP::host][HTTP::uri]"
} else { HTTP::redirect "http://www.[HTTP::host][HTTP::uri]"
}
} else { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
}
So to summarize, this will take all http traffic to http://www.domainname.com or http://domainname.com and redirect it to https://www.domainname.com. It is applied on my port 80 virtual server.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects