Created
June 24, 2020 08:45
-
-
Save skttl/f37392d304561583b44a4e87ddd3c082 to your computer and use it in GitHub Desktop.
Redirect all topdomain traffic (without subdomains) to www.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<rule name="Redirect all topdomain traffic (without subdomains) to www." stopProcessing="true"> | |
<match url=".*" /> | |
<conditions> | |
<add input="{HTTP_HOST}" pattern="^[^\.]*\.([^\.]+)$" /> | |
<!-- | |
https://regex101.com/r/6be5ka/1/ | |
^ asserts position at start of a line | |
Match a single character not present in the list below [^\.]* | |
* Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy) | |
\. matches the character . literally (case sensitive) | |
\. matches the character . literally (case sensitive) | |
1st Capturing Group ([^\.]+) | |
Match a single character not present in the list below [^\.]+ | |
+ Quantifier — Matches between one and unlimited times, as many times as possible, giving back as needed (greedy) | |
\. matches the character . literally (case sensitive) | |
$ asserts position at the end of a line | |
--> | |
</conditions> | |
<action type="Redirect" url="https://www.{C:0}/{R:0}" redirectType="Permanent" /> | |
</rule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment