Forum Discussion
F5user13_114603
Cirrus
Aug 14, 2016Https redirection only works for root domain and not for virtual directories
Hi,
I have an issue where in the http to https redirection works for the root domain and fails to work for the virtual directories.
Example: http://example.com gets redirected to https://example.com but http://example.com/default.aspx does not redirect to https://example.com/default.aspx
Please help.
1 Reply
- Vijay_E
Cirrus
This would be a simple iRule for such a redirection:
when HTTP_REQUEST { HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]" }Similar redirection but after checking the domain:
when HTTP_REQUEST { if { [HTTP::host] eq "example.com" } { HTTP::respond 301 Location "https://[HTTP::host][HTTP::uri]" } }For LTM Policies: Under the Parameters operand, type the following text in the box:
https://[getfield [HTTP::host] ":" 1][HTTP::uri]
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