2017-08-30 10 views
1

「#」文字で始まるweb.configファイルで書き換えルールを作成しようとしています。'#'で始まる書き換えルールを作成する方法

私は次のURL "www.example.com/#abcd= http://www.example.com/myfolder/mypage"を持っています。このURLは「www.example.com/myfolder/mypage.html」にリダイレクトする必要があります。

私は以下のルールを試しましたが、動作していないようです。

<rule name="myRedirect" stopProcessing="true" patternSyntax="ExactMatch" > 
    <match url="##abcd=http://www.example.com/myfolder/mypage" ignoreCase="false"/> 
    <action type="Redirect" url="myfolder/mypage.html" appendQueryString="true" redirectType="Permanent" /> 
    </rule> 

と、次の

<rule name="myNewRedirect" stopProcessing="true"> 
     <match url="(.*)"/> 
     <conditions> 
      <add input="{QUERY_STRING}" pattern="cbp=http://www.example.com/myfolder/mypage" /> 
     </conditions> 
     <action type="Redirect" url="/myfolder/mypage.html" redirectType="SeeOther"/> 
     </rule> 

しかし、上記のいずれも機能していません。

答えて

1

ハッシュ文字列に基づいてリダイレクトすることはできません。ブラウザはその部分(ハッシュ後のすべて)をサーバーに送信しません。

フラグメント識別子といい、クライアント側のみです。 URLの一部をサーバーに送信するブラウザ実装(またはソフトウェア)を使用していない限り、どの言語でも可能ではありません。リファレンス:http://en.wikipedia.org/wiki/Fragment_identifier

関連する問題