• I’d like to use a regex expression to a url redirect that is case insensitive. I have several URLs that will likely be capitalized different ways when people type them in and I’d rather not have to enter every possible permutation as a redirect.

    Help! I’m no good with regex stuff. Could you tell me what it should be?

    https://wordpress.org/plugins/redirection/

Viewing 2 replies - 1 through 2 (of 2 total)
  • First you need to understand the delimiter of the regex is changed from / to @ and that it’s concatenated later, when the check for the URL is made. This means you don’t need to provide it in the input field and you don’t need to escape the / character.

    Let’s take an example. You have a post that has the URL path /old/test. Also, there are places on the internet or your website that link it as /old/Test. You want to redirect both to /new/test.

    First you need to enable the regex mode via the checkbox in the editor.

    Second, you need to say that you want to match case insensitive. For this you need to start your match string with (?i). The result should look something like:

    (?i)/old/test

    Third, optionally you can make the match to be exact by adding start and end modifiers, like so:

    ^(?i)/old/test$

    This is terrific information. Could it please be added to the FAQ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using Regex Expressions’ is closed to new replies.