【问题标题】:Matching patterns on Azure rules engine for redirectsAzure 规则引擎上用于重定向的匹配模式
【发布时间】:2019-11-20 13:54:48
【问题描述】:

我们正在从 netlify 迁移到 azure,我需要重新创建一些重定向,例如:

[[redirects]]
  from = "https://www.aaa.jp/ja-jp/*"
  to = "https://www.aaa.com/ja-jp/:splat"
  status = 302
  force = true

我尝试使用 Azure CDN 和默认的 Microsoft 层,但运气不佳,因为在搜索文档后,我仍然不知道如何匹配模式(如上面的 * 和 :splat)。

【问题讨论】:

    标签: azure azure-web-app-service azure-cdn


    【解决方案1】:

    如果您使用在 Windows 上运行的 Azure App Service 应用程序,则可以在 web.config 文件中编写重定向规则,如 blog 中所述。

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="Redirect old-domain to new-domain" stopProcessing="true">
                        <match url=".*" />
                        <action type="Redirect" url="http://<<appdomain>>/{R:0}" redirectType="Permanent" />
                    </rule>              
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
    

    【讨论】:

    • 这不是他要问的。他正在寻找有关 Microsoft 标准规则引擎的解决方案。
    猜你喜欢
    • 1970-01-01
    • 2023-02-09
    • 1970-01-01
    • 1970-01-01
    • 2017-11-10
    • 1970-01-01
    • 1970-01-01
    • 2022-11-10
    • 1970-01-01
    相关资源
    最近更新 更多