Url rewriting IIS8重写以强制https,特定路径除外
我的网站是asp.net。 我在博客文件夹中有一个wordpress博客,一切都很好 我的主web.config有一个工作规则,它强制在所有内容上使用https 我已经成功地在blog文件夹的web.config中添加了一条规则,不重定向到https。 我的问题是,我想从该规则中排除wp content/uploads/*文件夹。 i、 e.我希望上传文件夹中的图像也可以加载到https上。 (我的理由是,我在我的主站点中引用了它们,而且我收到的安全消息表明我的https页面上有不安全的内容) 我的代码是:Url rewriting IIS8重写以强制https,特定路径除外,url-rewriting,iis-8,Url Rewriting,Iis 8,我的网站是asp.net。 我在博客文件夹中有一个wordpress博客,一切都很好 我的主web.config有一个工作规则,它强制在所有内容上使用https 我已经成功地在blog文件夹的web.config中添加了一条规则,不重定向到https。 我的问题是,我想从该规则中排除wp content/uploads/*文件夹。 i、 e.我希望上传文件夹中的图像也可以加载到https上。 (我的理由是,我在我的主站点中引用了它们,而且我收到的安全消息表明我的https页面上有不安全的内容)
<rule name="Remove https" enabled="true" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_URI}" pattern="^wp-content/uploads/.*" negate="true" />
<add input="{HTTPS}" pattern="on" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}/blog/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
我做错了什么
谢谢您的代码有问题亲爱的请尝试下面的代码这可以帮助您
<rule name="Remove https" enabled="true" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_URI}" pattern="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" negate="true" />
<add input="{HTTPS}" pattern="on" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}/blog/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
您尝试的“^wp content/uploads/*”模式中出现错误。下面的代码可以帮助您
<rule name="Remove https" enabled="true" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_URI}" pattern="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" negate="true" />
<add input="{HTTPS}" pattern="on" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}/blog/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
我不想否定所有这些文件夹。我只想否定wp内容/上传folder我们都没有注意到这个错误。它应该是action type=none