简体   繁体   English

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

[英]Convert htaccess rule to config.web on windows server

I need to use this rule on a Plesk Windows server.我需要在 Plesk Windows 服务器上使用此规则。

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

Can someone show me how to use this rule in the web.conf file?有人可以告诉我如何在web.conf文件中使用此规则吗?

The resulting web.config should look similar to this:生成的 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM