2016-06-23 5 views
0

フォーラムアプリケーションの古いURLはhttp://mydomain.tld/showthread.php?p=xxxxを指します。ここで、xxxxは整数IDです。IISは書き換えファイル名を変更します

私の新しいフォーラムアプリケーションではviewtopic.php?p=xxxxが使用されており、IIS web.configの書き換えルールを使用してこれを処理したいと考えています。

私は次のように最後のルールを追加しようとしました:

<rewrite> 
      <rules> 
       <rule name="Redirect www to non www" patternSyntax="ECMAScript" stopProcessing="true"> 
        <match url="(.*)" /> 
        <action type="Redirect" url="http://domain.tld/{R:1}" /> 
        <conditions> 
         <add input="{HTTP_HOST}" pattern="^domain\.tld" negate="true" /> 
        </conditions> 
       </rule> 

       <!-- this for change from showthread.php to viewtopic.php --> 
       <rule name="Rewrite" stopProcessing="true"> 
        <match url="(.*)showthread\.php" /> 
        <action type="Rewrite" url="viewtopic\.php" appendQueryString="true" /> 
       </rule> 
      </rules> 
     </rewrite> 

しかし、それはviewtopic.phpにリダイレクトすることはできません。なにか提案を?

答えて

0

IISでenable httpRedirectにする必要があります。次に、このリダイレクトルールをフォーラムのルートにあるweb.configで使用しました。

<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found"> 
     <add wildcard="*showthread.php" destination="/viewtopic.php?$P" /> 
</httpRedirect> 
関連する問題