广告位

您现在的位置是:主页 > 重定向 >

IIS实现301重定向带参数(传递特定值)

2020-05-31 22:14重定向 人已围观

简介代码如下 rewrite rules rule name=Redirect stopProcessing=true match url=^technology/(.*).html$ / conditions logicalGrouping=MatchAll trackAllCaptures=false / action type=Redirect url=www.test.com/html/{R:1}.html / /rule rule name=Redirec...

代码如下
<rewrite>
<rules>
<rule name="Redirect" stopProcessing="true">
<match url="^technology/(.*).html$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="www.test.com/html/{R:1}.html" />
</rule>

<rule name="Redirect2" stopProcessing="true">
<match url="^market/(.*).html$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://test.com/html/{R:1}.html" />
</rule>

<rule name="Redirect3" stopProcessing="true">
<match url="^aluminum/(.*).html$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://test.com/html/{R:1}.html" />
</rule>

<rule name="Redirect4" stopProcessing="true">
<match url="^industry/(.*).html$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://test.com/html/{R:1}.html" />
</rule>

<rule name="Redirect5" stopProcessing="true">
<match url="^example/(.*).html$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://test.com/html/{R:1}.html" />
</rule>

<rule name="Redirect6" stopProcessing="true">
<match url="^drawing/(.*).html$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://test.com/html/{R:1}.html" />
</rule>


<rule name="Redirect7" stopProcessing="true">
<match url="^mold/(.*).html$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://test.com/html/{R:1}.html" />
</rule>

<rule name="Redirect8" stopProcessing="true">
<match url="^standard/(.*).html$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://test.com/html/{R:1}.html" />
</rule>
</rules>
</rewrite>
注: 上面代码的作用是
需要将
technology/xxxxx.html
market/xxxxx.html
aluminum/xxxxx.html
industry/xxxxx.html
example/xxxxx.html
drawing/xxxxx.html
mold/xxxxx.html
standard/xxxxx.html
等文件全部重定向到另外一个域名(或本域名下其他文件夹中)以上几类页面全部合并到一个文件夹"html"中;
文件名保持不变(无重名文件);
生效后;所有页面均能正确的跳转页面;

Tags:

广告位
    广告位

本栏推荐

    广告位

标签云

站点信息

  • 文章统计74篇文章
  • 标签管理标签云
  • 微信公众号:扫描二维码,关注我们