Applying 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 client SSL profile).
I currently have this iRule below on the HTTP virtual server and this works perfectly.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] eq "mysitename.com" } then {
HTTP::respond 301 noserver Location "https://www.mysitename.com[string tolower [HTTP::uri]]"
} else {
HTTP::respond 301 noserver Location "https://[getfield [HTTP::host] ":" 1][string tolower [HTTP::uri]]"
}
}
This iRule correctly forces HTTP traffic to HTTPS with a 301 response code and forces the URI's to lowercase.
E.g. http://www.sitename.com/WHATEVER gets converted to https://www.sitename.com/whatever
So this is all good.
However my problem is that I can't work out how to do the same lowercase rule for the HTTPS virtual server connections.
I currently have this iRule below applied to the HTTPS virtual server and nothing is being converted to lowercase.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] starts_with "mysitename.com" } {
HTTP::respond 301 noserver Location "https://www.mysitename.com[string tolower [HTTP::uri]]"
}
}
E.g. https://www.sitename.com/WHATEVER remains as https://www.sitename.com/WHATEVER
Is there a way to force lowercase to the HTTPS virtual server as well?
Any advice would be appreciated.
Thanks in advance!