大网数据广告活动
服务器运维问答

Wordpress and IIS - How can I force HTTPS redirection and use Permalinks?

· 52CE 我爱测

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. IIS URL Rewrite Screenshot The problem is, HTTPS redirection isn't wor…

问题原文

原帖链接 · 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.

IIS URL Rewrite Screenshot

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-03-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。