我有一个HTTP到https重定向规则,该规则可以正常工作。但是,启用HTTP到https规则后,无法获得用于页面重定向的单独规则。我在处理web.config和站点配置方面经验有限,因此无法确定问题所在。
我尝试禁用http to https规则,此后“ Old Page Redirects”规则按预期工作。但是我需要同时启用两个规则。我在这里包括了重写规则以及重写映射中的示例。请注意,对于我的CMS,我还有一些规则可以创建SEF URL。
<rewrite>
<rewriteMaps configSource="Web.RewriteMaps.config" />
<rules>
<rule name="Old Page Redirects" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{OldPages:{REQUEST_URI}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" appendQueryString="false" redirectType="Permanent" />
</rule>
<rule name="CMS Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{QUERY_STRING}" pattern="base64_encode[^(]*\([^)]*\)" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="(>|%3C)([^s]*s)+cript.*(<|%3E)" />
<add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
<add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
</conditions>
<action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="CMS Rule 2">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" pattern="^/index.php" ignoreCase="true" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
<rule name="HTTP to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
<!-- sample key and value from rewrite map is below -->
<rewriteMaps>
<rewriteMap name="OldPages">
<add key="/closeup.asp?pid=2115" value="/furniture/cabinets-chests/rosewood-dragon-phoenix-design-armoire-b0hc02xc" />
</rewriteMap>
</rewriteMaps>
答案 0 :(得分:0)
看起来这个问题只是一个优先事项。我将http to https规则移到顶部,然后重定向按预期工作。