0

これは、URL から index.cfm を削除するように設計された (正しく機能している) 私の書き直しの例です。

ただし、以下のように複数の書き換えを行うのではなく、1 つだけですべてを処理できるようにしたいと考えています。

ルールを 1 つだけ持つことができるように、このパターンに一致する正規表現式が必要であると考えていました。

<rule name="Remove index.cfm from About Us" stopProcessing="true">
  <match url="index.cfm$" />
    <conditions>  
      <add input="{QUERY_STRING}" pattern="page=8467" />  
    </conditions>  
    <action type="Redirect" url="http://www.mydomain.com?page=8467" redirectType="Permanent" appendQueryString="false" />
</rule>
<rule name="Remove index.cfm from Biography Page" stopProcessing="true">
  <match url="index.cfm$" />
    <conditions>  
      <add input="{QUERY_STRING}" pattern="page=8469" />  
    </conditions>  
    <action type="Redirect" url="http://www.mydomain.com?page=8469" redirectType="Permanent" appendQueryString="false" />
</rule>
<rule name="Remove index.cfm from Video Page" stopProcessing="true">
  <match url="index.cfm$" />
    <conditions>  
      <add input="{QUERY_STRING}" pattern="page=8473" />  
    </conditions>  
    <action type="Redirect" url="http://www.mydomain.com?page=8473" redirectType="Permanent" appendQueryString="false" />
</rule>
4

1 に答える 1

0

私はそれを考え出した。もっとうまく説明できればいいのですが、私は web.config ではなく .htaccess に慣れています。

<rule name="Remove index.cfm from URLs" stopProcessing="true">
  <match url="index.cfm$" />
    <conditions>  
      <add input="{QUERY_STRING}" pattern="page=([0-9]+)" />  
    </conditions>  
  <action type="Redirect" url="http://www.mydomain.com/?page={C:1}" redirectType="Permanent" appendQueryString="false" />
</rule>
于 2013-10-09T18:25:23.747 に答える