在 windows 服务器上将 htaccess 规则转换为 config.web

Convert htaccess rule to config.web on windows server

我需要在 Plesk Windows 服务器上使用此规则。

RewriteCond %{REQUEST_URI} ^\/(invoice|offer)\/(.*) [NC]
RewriteRule ^(.*)$ https://dev.domain.com/ [R=301,NC,L]

谁能告诉我如何在 web.conf 文件中使用这条规则?

生成的 web.config 应该与此类似:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Rule 1" stopProcessing="true">
                    <match url="^(.*)$"/>
                    <conditions>
                        <add input="{URL}" pattern="^\/(invoice|offer)\/(.*)"/>
                    </conditions>
                    <action type="Redirect" redirectType="Permanent" url="https://dev.domain.com/{R:1}"/>
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>