我已经在azure应用服务上安装了wordpress,并尝试为基本网址设置重定向。
当有人进入" https://website.co/integration-resources"或" https://website.co/integration-resources/"它应该重定向到https://website.co/integrations
然而,当某人键入https://website.co/integration-resources/add-to-cart时,应该允许。
<rule name="Configure Python" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" />
<add input="{URL}" pattern="^/blog/.*" ignoreCase="true" negate="true" />
<add input="{URL}" pattern="^/blog" ignoreCase="true" negate="true" />
<add input="{URL}" pattern="^/integration-resources/.*" ignoreCase="true" negate="true" />
</conditions>
<action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true"/>
</rule>
<rule name="Configure Python 1" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{URL}" pattern="^/integration-resources" ignoreCase="true" negate="true" />
</conditions>
<action type="Rewrite" url="handler.fcgi/integrations" appendQueryString="true"/>
</rule>
</rules>
答案 0 :(得分:1)
如果您添加如下规则,这将有效:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect for the base URL" stopProcessing="true">
<match url="^integration-resources[\/]?$" />
<action type="Redirect" url="integrations" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
答案 1 :(得分:0)
您应该将此规则添加到规则之上
<rule name="integration-resources redirect" stopProcessing="true">
<match url="^integration-resources/?$" ignoreCase="false" />
<action type="Redirect" url="/integrations" appendQueryString="true"/>
</rule>
仅当您的网址为^integration-resources/?$
或integration-resources
integration-resources/
才会匹配