jeudi 28 novembre 2019

How to use generic method instead of domain.com in web.config rule

I have following rule in web.config file that works fine, for prefixing www to a URL


    <rewrite>

          <rules>
            <rule name="ForceWWW" stopProcessing="true">
              <match url=".*" ignoreCase="true" />
              <conditions>
                <add input="{HTTP_HOST}" pattern="^domain.com" />
              </conditions>
              <action type="Redirect" url="https: // www.domain.com/{R:0}" redirectType="Permanent" />
            </rule>

        </rewrite>

How to replace domain.com with something generic? something like {HTTP_HOST} or {C:1} ?

so that I can copy paste this rule to other domain's web.config file without modigying?




Aucun commentaire:

Enregistrer un commentaire