Forum Discussion
1000blocks
Nimbostratus
Mar 07, 2017Applying lowercase iRule to HTTPS virtual server?
Hi,
For SEO reasons, I need to apply force all HTTP requests to my site to be lowercase.
The Big-IP configuration for the site is a HTTP virtual server and a HTTPS virtual server (with a cl...
Stanislas_Piro2
Cumulonimbus
Mar 17, 2017Hi,
can you try this irule:
when HTTP_REQUEST {
Manage HTTP / HTTPS and host values
switch -glob -- [string tolower [HTTP::host]] {
"mysitename.com" -
"mysitename2.com" {
set RedirLocation "https://www.[string tolower [HTTP::host]]"
}
"www.mysitename.com" -
"www.mysitename2.com" {
if {[TCP::local_port] equals 80} {
set RedirLocation "https://[string tolower [HTTP::host]]"
} else {
set RedirLocation ""
}
}
default {
set RedirLocation ""
}
}
Manage Path values
if {[ set path [string tolower [HTTP::path]]] ne [HTTP::path]} {
Convert path to lowercase to be used in redirect
HTTP::path $path
append RedirLocation [HTTP::uri]
} else {
append RedirLocation [HTTP::uri]
}
redirect if Host, protocol or path require redirect
if {$RedirLocation ne [HTTP::uri]} {
HTTP::respond 301 noserver Location $RedirLocation
}
}
this irule check port, hostname and path values to create a variable RedirLocation with redirect URL (relative if host and scheme are unchanged, absolute else)
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
