簡體   English   中英

URL重寫-如何使用http和https在同一網站上配置多個域

[英]URL Rewriting - how to configure multiple domain on same website with http and https

我有一個指向多個域的網站應用程序。

我想要的是,如果用戶訪問domain1.com,則應將其重定向到https://www.domain1.com

並保留所有指向同一應用程序且不使用https的域(例如http://www.domain2.com / http://www.domain3.com

域必須重定向如下:

  1. domain1.com> https://www.domain1.com
  2. domain2.com> http://www.domain2.com (重寫以下代碼)
  3. domain3.com> http://www.domain3.com (重寫以下代碼)

下面的代碼可為https域以外的域重寫。

<rule name="domain1" stopProcessing="true">
   <match url="^www.domain1.com$" negate="true" />          
   <action type="Rewrite" url="otherdomain/{R:1}" />
</rule>

提前申請您的幫助。 謝謝

您可以嘗試以下配置嗎?

<rules>
    <rule name="Remove WWW prefix" stopProcessing="true">
      <match url="(.*)" ignoreCase="true" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^www\.domain1\.com$" />
      </conditions>
      <action type="Redirect" url="https://www.domain1.com/{R:1}" redirectType="Permanent" />
    </rule>
  </rules>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM