2012-05-14 188 views
0

我们已将我们的网站从一个php apache站点移动到一个asp.net mvc站点,并试图让特定的重定向工作但陷入困境。将特定页面重定向到iis web.config中的另一个特定页面

基本上我想为http://www.mysite.com/index.php?pr=about_us的任何请求重定向到http://www.mysite.com/About-Us

我已经试过,但它不工作。有任何想法吗?

<rewrite> 
    <rules> 
    <rule name="About Us" stopProcessing="true"> 
     <match url="index.php?pr=About_Us" ignoreCase="false" /> 
     <action type="Redirect" redirectType="Permanent" url="http://www.mysite.com/About-Us" /> 
    </rule> 
    </rules> 
</rewrite> 

我也试过这个,但它也没有工作。

<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Permanent"> 
    <add wildcard="index.php?pr=About_Us" destination="/About-Us" /> 
</httpRedirect> 

我有大约一打这些特定的重定向,我需要实现各种页面。

任何帮助,非常感谢! 感谢

回答

2

试试这个:

<rule name="About Us" stopProcessing="true"> 
    <match url="^(.*)$"> 
     <conditions> 
      <add input="{URL}" pattern="index.php?pr=About_Us" /> 
     </conditions> 
    </match> 
    <action type="Redirect" redirectType="Permanent" url="http://www.mysite.com/About-Us" /> 
</rule> 

编辑

这是条件的另一种可能性:

<conditions logicalGrouping="MatchAll"> 
    <add input="{QUERY_STRING}" pattern="?pr=About_Us" /> 
    <add input="{REQUEST_FILENAME}" pattern="index.php" /> 
</conditions> 

编辑 - 工作液

<rule name="About Us" stopProcessing="true"> 
    <match url="^(.*)$" /> 
    <conditions logicalGrouping="MatchAll"> 
     <add input="{QUERY_STRING}" pattern="/?pr=About_Us$" /> 
     <add input="{REQUEST_FILENAME}" pattern="index.php" /> 
    </conditions> 
    <action type="Redirect" redirectType="Permanent" url="http://www.mysite.com/About-Us" /> 
</rule>