zy13665886 2019-09-09 14:19 采纳率: 0%
浏览 570
已结题

IIS怎么302 URL重定向?http to https以及目录重定向二级域名

www/zj/
实现目标:
1、http 跳转到 https
2、www.a.com/zj/ 目录跳转 zj.a.com

实际代码:
写在 httpd.ini 里

RewriteCond Host: ([\d]+|zj)\.a\.com
RewriteRule ^(?!/images/)(?!/js/)(?!/css/)(.*)      /$1$2   [I,L]

2、http转为https
在 web.config

<rules>
   <rule name="HTTP to HTTPS redirect" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
      <add input="{HTTPS}" matchType="Pattern" pattern="^on$" ignoreCase="true" negate="true"/>
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
      </rule>
</rules>

最后在浏览器输入 a.com 跳转到了 https://zj.a.com/zj/

问题描述:
1、https成功
2、怎么修改把后面的 /zj/不要

  • 写回答

1条回答 默认 最新

  • threenewbee 2019-09-09 18:49
    关注

    RewriteCond Host: ([\d]+|zj).a.com
    这里去掉zj就是了\d+就是数字,或者zj

    评论

报告相同问题?