Currently, on my Production server, i have Inbound Rule set as follows which works file for all my requirements.
Inbound Rule is as follows.
Match URL section
Requested URL: Matches the Pattern
Using: Regular Expression
Pattern: (.*)
Ignore Case: checked.
Conditions section
Logical grouping: Match All.
Input: {HTTPS}
Type: Matches the Pattern
Pattern: ^OFF$
Track capture groups across conditions: unchecked.
Action section:
Action type: Redirect
Redirect URL: https://www.domainname.com/{R:0}
Append query string: checked.
Redirect Type: Permanent (301).
My Requirement is: When user types
https://beta.domain.com it should redirect to https://www.domain.com.
if user types
http://beta.domain.com it should redirect to https://www.domain.com.
If user types
http://www.domain.com it should redirect to https://www.domain.com
If user types
http://domain.com it should redirect to https://www.domain.com
Thanks in advance. Any help would be appreciated.
Thanks in advance.
Isn't that exactly what the conditional is suppose to do? It checks whether HTTPS is OFF and only then the redirect will happen. If HTTPS is ON it is not suppose to redirect otherwise you will end up in an endless redirect.
If you always want the hostname to be
www.domainname.com
you should add that as an additional conditional. E.g.:If either
HTTPS
is notON
orHTTP_HOST
is notwww.domainname.com
it will redirect. Only if both are true, it will not redirect.