たちのコメントは以下のEDIT:
http://yehaa.foo.com/
を使用してhttp://foo.com/xyzPage.aspx?barvalue=yehaa
にアクセスするには、次のルールを使用する必要があります。
<rules>
<rule name="Rewrite subdomains">
<match url="^/?$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(.+)\.foo\.com$" />
</conditions>
<action type="Rewrite" url="http://foo.com?barvalue={C:1}" />
</rule>
</rules>
をそれで終わるかどうか、すべてのURLに一致しますa /
とし、foo.com
の前に何かを使用して、それをhttp://foo.com?barvalue={C:1}
に書き換えます。ここで、{C:1}
は、foo.com
の前に入力された値です。
ユーザーがhttp://foo.com?barvalue={C:1}
に直接アクセスしないようにするには、次のルールを使用します。
あなたweb.config
ファイルに次のルールを追加することでRewrite module for IISを使用することができます。
<rewrite>
<rules>
<rule name="Redirect to Subdomains" stopProcessing="true">
<match url="^xyzPage.aspx$" />
<conditions>
<add input="{QUERY_STRING}" pattern="^barvalue=(.+)$" />
</conditions>
<action type="Redirect" url="http://{C:1}.{HTTP_HOST}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
URLは正確にxyzPage.aspx
(何の前または後に)一致していないか調べ。
クエリ文字列にbarvalue
パラメータ(およびこのパラメータのみ)が含まれていて、その値が空でないかどうかを確認します。
これらの2つの条件がOKの場合、Redirect
〜http://barvalue.original.host
がトリガーされます。
あなたの質問にはRewrite
を指定してください。実際にやりたいことがあれば、type="Redirect"
をtype="Rewrite"
に変更してください。
重要:あなたは別のドメインにRewrite
に有効なプロキシモードでインストールApplication Request Routing moduleとセットアップが必要な場合があります。
IIS用の書き換えモジュールを使用して行うことができます。 – cheesemacfly
どのような例をお願いしますか? –