【发布时间】:2023-03-10 10:09:01
【问题描述】:
我想为
设置 301 重定向mysite.com/banana mysite.com/fruit
mysite.com/banana/yellow mysite.com/fruit/yellow
mysite.com/banana/yellow/sale mysite.com/fruit/yellow/sale
(“yellow”和“sale”这两个词可以替换成任何东西,它们是路径中的变量。)
这适用于第一种情况,但不适用于其他情况:
<rule name="banana" stopProcessing="true">
<match url="banana" />
<action type="Redirect" url="fruit" />
</rule>
基于这个问题: replace underscore with dash using url rewrite module of iis
这仅适用于第三种情况:
<rule name="banana" stopProcessing="true">
<match url="(mysite.com.*/[^/]*?)banana/([^/_]*)/([^/_]*)$" />
<action type="Redirect" url="{R:1}fruit/{R:2}/{R:3}" />
</rule>
我需要的是一个返回的正则表达式
{R:1} mysite.com/
{R:2} /黄色/销售
或
{R:1} mysite.com/
{R:2}
【问题讨论】:
标签: asp.net regex iis-7.5 url-rewrite-module