我已经在Azure App Services上安装了WordPress,并试图为基本URL设置重定向。
当有人进入" https://website.co/integration-resources"或" https://website.co/integration-resources/"时,它应该重定向到https://website.co/integration>
但是,当某人键入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>
如果添加这样的规则,这将有效:
<?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>
您应该在规则上方添加此规则
<rule name="integration-resources redirect" stopProcessing="true">
<match url="^integration-resources/?$" ignoreCase="false" />
<action type="Redirect" url="/integrations" appendQueryString="true"/>
</rule>
REGEXP ^integration-resources/?$
仅在您的URL为integration-resources
或integration-resources/