ZUREAPP服务重定向与子域和参数

问题描述 投票:0回答:1
我需要将该特定URL重定向到

NewSubDomain.newexample.com/route?newID =34563456456

我需要包括的这些URL重定向中有15个。它们是特定的和宽容的。

我已经阅读了一种方法可以在Web中进行此操作。 Cheers

我已经阅读了一种方法可以在Web中进行此操作。

是的,可以使用

web.config

.

重定向多个URL。

感谢@thomas ardal的明确解释。请参阅此
azure http-redirect azure-web-app-service
1个回答
0
投票
,以更好地理解Web.config使用重写规则的多个URL重定向。 themend是示例

Web.config

文件:

您可以在
<rule>

部分中添加多个元素以匹配不同的URL并相应地重定向。

<rules> 现在将应用程序部署到Azure应用程序服务后,当您从子域重定向时,您必须在Azure中进行配置。

go到Azure->选择您的应用程序服务 - >自定义域 - >添加自定义域 - >输入您的

<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="RedirectRoute1" stopProcessing="true"> <match url="route" /> <conditions> <add input="{HTTP_HOST}" pattern="^subdomain\.example\.com$" /> <add input="{QUERY_STRING}" pattern="someID=123&otherId=4356" /> </conditions> <action type="Redirect" url="https://newsubdomain.newexample.com/route?newID=34563456456" redirectType="Permanent" /> </rule> <rule name="RedirectRoute2" stopProcessing="true"> <match url="old-page" /> <conditions> <add input="{HTTP_HOST}" pattern="^subdomain\.example\.com$" /> </conditions> <action type="Redirect" url="https://newsubdomain.newexample.com/new-page" redirectType="Permanent" /> </rule> <rule name="RedirectRoute3" stopProcessing="true"> <match url="another-route" /> <conditions> <add input="{HTTP_HOST}" pattern="^subdomain\.example\.com$" /> </conditions> <action type="Redirect" url="https://newsubdomain.newexample.com/different-route" redirectType="Permanent" /> </rule> </rules> </rewrite> </system.webServer> </configuration> ->验证后,将其绑定到应用程序。

引用此

doc1

doc2
了解将子域映射到Azure网站。
参考链接。
,您也可以将

subdomain.example.com
用作替代方法
samame

web.config:


Rewrite Map

enter image description here通过上述方法,您可以使用

<rewriteMaps> <rewriteMap name="RedirectsMap"> <add key="subdomain.example.com/route?someID=123&otherId=4356" value="https://newsubdomain.newexample.com/route?newID=34563456456" /> <add key="subdomain.example.com/old-page" value="https://newsubdomain.newexample.com/new-page" /> <add key="subdomain.example.com/another-route" value="https://newsubdomain.newexample.com/different-route" /> </rewriteMap> </rewriteMaps>

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.