WordPress.org

Ready to get started?Download WordPress

Forums

Redirection
Regex Syntax for case insensitivity? (2 posts)

  1. toobaroo
    Member
    Posted 3 years ago #

    What is the Regex Syntax for case insensitivity? I want my redirects to work whether someone types in upper or lower or a combination.

    For example:

    Source: /contact or /CONTACT or /CoNtAct

    Target: http://domainname/contact-my-company-name

    How do I use "regex" to make sure that any variation of the source, regardless of upper/lower case will still work properly and redirect

  2. openmtl
    Member
    Posted 2 years ago #

    You can't do that with the /i flag because of how the from URL is poked into the preg_match() in the redirector code but you must do it like this in the from URL...

    ^/+(C|c)(O|n)(T|t)(A|a)(C|c)(T|t)/*.*

    as an example. That will match /Contact or /CONTACT//// or anythig in between e.g. /CoNtAcT/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic