简体   繁体   English

IIS URL将Http重写为Https,排除单个URL

[英]IIS URL Rewrite Http to Https, exclude single URL

I have several sites set up that are using a URL Rewrite to direct Http to Https. 我设置了几个使用URL重写将Http定向到Https的站点。

All sites are setup with two sub-folders. 所有站点都设置有两个子文件夹。 Example: 例:

  1. http://www.example.net http://www.example.net
  2. http://www.example.net/abc http://www.example.net/abc
  3. http://www.example.net/xyz http://www.example.net/xyz

This is my current URL Rewrite Inbound Rule settings: 这是我当前的URL重写入站规则设置:

  • Pattern: (.*) 模式:(。*)
  • Condition input: {HTTPS} 条件输入:{HTTPS}
  • Check if input string: Matches the Pattern 检查输入字符串是否与模式匹配
  • Pattern: ^OFF$ 模式:^ OFF $
  • Action Type: Redirect 动作类型:重定向
  • Redirect URL: https://{HTTP_HOST}/{R:1} 重定向网址:https:// {HTTP_HOST} / {R:1}
  • Redirect type: Permanent (301) 重定向类型:永久(301)

All three re-direct to Https perfectly. 所有这三个都完美地重定向到Https。

However, I need to exclude one of the sub folders from this rule and NOT re-direct it to Https ( http://www.example.net/abc ). 但是,我需要从此规则中排除一个子文件夹,并且不要将其重定向到Https( http://www.example.net/abc )。

Could this be accomplished by modifying the existing rule condition? 是否可以通过修改现有规则条件来完成? Or even better, by adding an additional rule or rule condition? 通过添加其他规则或规则条件,甚至更好?

You can modify the existing rule and add additional condition: 您可以修改现有规则并添加其他条件: 在此处输入图片说明

Condition input: {REQUEST_URI} 条件输入: {REQUEST_URI}

Check if input string: Does Not Match the Pattern 检查输入字符串: Does Not Match the Pattern

Pattern: ^/abc 格式: ^/abc

With this condition, rule will exclude all URLs, which starting from abc . 在这种情况下,rule将排除所有从abc开头的URL。 For example, these URLs will be excluded: 例如,以下URL将被排除:

  • /abc / abc
  • /abcdef / abcdef
  • /abc/xyz / abc / xyz

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM