简体   繁体   中英

Convert htaccess rule to config.web on windows server

I need to use this rule on a Plesk Windows server.

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?

The resulting web.config should look similar to this:

<?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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