我在IIS服务器上运行了ExpressionEngine安装。目前我正在使用重写规则,强制网站在每个页面上使用HTTPS协议。我想改变它,以便它在除主页之外的每个页面上使用HTTPS。不幸的是,我对web.config重写规则知之甚少。提前谢谢!
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
答案 0 :(得分:1)
如果您不想将重定向规则应用于您的主页,则需要添加条件并过滤主页网址。它应该是这样的:
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{REQUEST_URI}" pattern="^/$" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>