URL Rewrite pravidla: Porovnání verzí

Z ASPone Help Wiki
Přejít na: navigace, hledání
Řádka 1: Řádka 1:
 
<h2>Přesměrování z HTTP na HTTPS</h2>
 
<h2>Přesměrování z HTTP na HTTPS</h2>
  
    <system.webServer>
+
<system.webServer>
        <rewrite>
+
  <rewrite>
            <rules>
+
    <rules>
                <rule name="HTTPS Redirect" stopProcessing="true">
+
        <rule name="HTTPS Redirect" stopProcessing="true">
                    <match url="(.*)" />
+
            <match url="(.*)" />
                    <conditions>
+
            <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
+
              <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
+
            </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
+
            <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
                </rule>
+
        </rule>
            </rules>
+
    </rules>
        </rewrite>
+
  </rewrite>
    </system.webServer>
+
</system.webServer>
  
 
<h2>Přesměrování z bez www na www a na HTTPS</h2>
 
<h2>Přesměrování z bez www na www a na HTTPS</h2>
Řádka 38: Řádka 38:
 
V pravidlu je potřeba upravit "vasedomena.cz" na název vaší domény.
 
V pravidlu je potřeba upravit "vasedomena.cz" na název vaší domény.
  
        <rewrite>
+
<system.webServer>
            <rules>
+
  <rewrite>
                <rule name="Force non-WWW and SSL" enabled="true" stopProcessing="true">
+
  <rules>
                  <match url="(.*)" />
+
    <rule name="nonWWW and HTTPS" enabled="true" stopProcessing="true">
                  <conditions logicalGrouping="MatchAny">
+
      <match url="(.*)" />
                      <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
+
      <conditions logicalGrouping="MatchAny">
                      <add input="{HTTPS}" pattern="off" />
+
          <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
                  </conditions>
+
          <add input="{HTTPS}" pattern="off" />
                  <action type="Redirect" url="https://vasedomena.cz/{R:1}" appendQueryString="true" redirectType="Permanent" />
+
      </conditions>
                </rule>
+
      <action type="Redirect" url="https://vasedomena.cz/{R:1}" appendQueryString="true" redirectType="Permanent" />
            </rules>
+
    </rule>
        </rewrite
+
  </rules>
 +
  </rewrite
 +
</system.webServer>

Verze z 23. 8. 2022, 10:28

Přesměrování z HTTP na HTTPS

<system.webServer>
 <rewrite>
   <rules>
       <rule name="HTTPS Redirect" stopProcessing="true">
           <match url="(.*)" />
           <conditions>
             <add input="{HTTPS}" pattern="^OFF$" />
           </conditions>
           <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
       </rule>
   </rules>
 </rewrite>
</system.webServer>

Přesměrování z bez www na www a na HTTPS

V pravidlu je potřeba upravit "www.vasedomena.cz" na název vaší domény.

<system.webServer>
 <rewrite>
   <rules>
     <rule name="WWW and HTTPS" enabled="true" stopProcessing="true">
	<match url="(.*)" />
	 <conditions logicalGrouping="MatchAny">
   	  <add input="{HTTP_HOST}" pattern="^[^www]" />
    	  <add input="{HTTPS}" pattern="off" />
	 </conditions>
 	 <action type="Redirect" url="https://www.vasedomena.cz/{R:1}" appendQueryString="true" redirectType="Permanent" />
     </rule>
   </rules>
 </rewrite>
</system.webServer>

Přesměrování z www na bez www a na HTTPS

V pravidlu je potřeba upravit "vasedomena.cz" na název vaší domény.

<system.webServer>
 <rewrite>
  <rules>
    <rule name="nonWWW and HTTPS" enabled="true" stopProcessing="true">
      <match url="(.*)" />
      <conditions logicalGrouping="MatchAny">
          <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
          <add input="{HTTPS}" pattern="off" />
      </conditions>
      <action type="Redirect" url="https://vasedomena.cz/{R:1}" appendQueryString="true" redirectType="Permanent" />
    </rule>
  </rules>
 </rewrite
</system.webServer>
Osobní nástroje
Jmenné prostory

Varianty
Akce
Navigace
Znalostní báze
Domény
ASPone.cz
Nástroje