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.

1 Answer 1

2

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

2
  • 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 "example.com/contact") goes to "/cart". Any idea why Wordpress would be doing that?
    – t0rxe
    Mar 31, 2019 at 13:34
  • Ah, nevermind. Seems it was because I had a trailing slash in the menu bar link. EG: "example.com/contact".
    – t0rxe
    Mar 31, 2019 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.