问题原文
原帖链接 · t0rxe · CC BY-SA 4.0
Currently, I have a Wordpress site which is running under IIS 10. I use custom permalinks and I use the following URL Rewrite rule to make my permalinks work.
The problem is, HTTPS redirection isn't working. By that I mean if I navigate my browser to http://example.com, it doesn't direct automatically to https://example.com.
So, how can I add a dual-rule which will do both these tasks I want without causing problem such as broken permanlinks?
Thanks.
已采纳解答
原帖链接 · Tim Liston · CC BY-SA 4.0
You need to create a second rule for the HTTPS redirect. Place it above your permalink rule so it gets parsed first.
Match URL
Requested URL: Matches the Pattern
Using: Regular Expressions
Pattern: (.*)
Ignore Case
Conditions
Match All
Input: {HTTPS}
Type: Matches the Pattern
Pattern: ^OFF$
Action
Action Type: Redirect
Action Properties
Redirect URL: https://{HTTP_HOST}/{R:1}
Append Query String
Redirect type: 301, 302, or 303
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
