Redirect iis web.config将特定域/路径重定向到新域/samepath

Redirect iis web.config将特定域/路径重定向到新域/samepath,redirect,iis,url-rewriting,web-config,Redirect,Iis,Url Rewriting,Web Config,我需要使用web.config为使用相同原始路径/文件夹的特定路径/文件夹设置重定向到新域 例: 如果检测到www.domain1.com/path2match1/*则重定向到: www.newdomain.com/path2match1/*(与域1上匹配的路径相同) 例: 当前:www.domain1.com/path2match1/someFileOrFolders/somefile.html 重定向至:www.newdomain.com/path2match1/someFileOrFold

我需要使用web.config为使用相同原始路径/文件夹的特定路径/文件夹设置重定向到新域

例: 如果检测到www.domain1.com/path2match1/*则重定向到: www.newdomain.com/path2match1/*(与域1上匹配的路径相同)

例: 当前:www.domain1.com/path2match1/someFileOrFolders/somefile.html 重定向至:www.newdomain.com/path2match1/someFileOrFolders/somefile.html

任何帮助都将不胜感激


谢谢

我自己设法找到了问题的答案!(对我来说太棒了!哈哈)

不管怎样, 下面是如何完成我的要求:

<rewrite>
    <rules>
        <rule name="NAME" stopProcessing="true">
            <match url=".*" />
            <conditions logicalGrouping="MatchAny">
            <add input="{HTTP_HOST}{REQUEST_URI}" pattern="(.*)/FOLDER/(.*)" />
            </conditions>
            <action type="Redirect" appendQueryString="false" url="http://DESTINATION-URL.TLD/FOLDERS/{C:2}" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>

是您要重定向到的位置

    我自己设法找到了问题的答案!(对我来说太棒了!哈哈)

    不管怎样, 下面是如何完成我的要求:

    <rewrite>
        <rules>
            <rule name="NAME" stopProcessing="true">
                <match url=".*" />
                <conditions logicalGrouping="MatchAny">
                <add input="{HTTP_HOST}{REQUEST_URI}" pattern="(.*)/FOLDER/(.*)" />
                </conditions>
                <action type="Redirect" appendQueryString="false" url="http://DESTINATION-URL.TLD/FOLDERS/{C:2}" redirectType="Permanent" />
            </rule>
        </rules>
    </rewrite>
    
    
    是您要重定向到的位置