1

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.

t0rxe
  • 17
  • 1
  • 6

1 Answers1

3

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

HTTPS Redirect_1 HTTPS Redirect_2

Tim Liston
  • 736
  • 3
  • 8
  • Awesome! That seems to be working better, but for some reason some of my permalinks go to the WooCommerce 'cart' URL. For example, my contact page (which has the page name "https://example.com/contact") goes to "/cart". Any idea why Wordpress would be doing that? – t0rxe Mar 31 '19 at 13:34
  • Ah, nevermind. Seems it was because I had a trailing slash in the menu bar link. EG: "https://example.com/contact/". – t0rxe Mar 31 '19 at 14:06