如何使用动态参数在web.config文件中设置重定向?

问题描述 投票:1回答:1

我的网址是这样的:https://myhospital.com/Hospitals-and-Clinics/Hospitals/Hospital-A/Our-Doctors

我尝试此脚本:

<location path="Our-Doctors">
    <system.webServer>
        <httpRedirect enabled="true" destination="https://www.appointment.myhospital.com/" httpResponseStatus="Permanent" />
    </system.webServer>
</location>

在Web配置中

但是它不起作用。它不会重定向到https://www.appointment.myhospital.com/

医院A是医院的名称

所以它可以这样:

https://myhospital.com/Hospitals-and-Clinics/Hospitals/Hospital-B/Our-Doctors

https://myhospital.com/Hospitals-and-Clinics/Hospitals/Hospital-C/Our-Doctors

它是动态的

我该如何解决这个问题?

在这种情况下是否使用正则表达式?

c# asp.net url web-config sitecore
1个回答
0
投票
您的配置不起作用,因为您输入的路径错误。必须是

<location path="Hospitals-and-Clinics/Hospitals">

您可以使用URL重写模块模块。像这样:
© www.soinside.com 2019 - 2024. All rights reserved.