Conditions, RegEx support for Netlify redirects similar to .htacess

Hi Netlify team,

One of our “Redirect” use case is to redirect, if the query string matches a specific value.
Currently, this kind of redirect is achieved via .htaccess file in Apache.
The following is an example from Apache’s .htacecess file:

RewriteCond %{QUERY_STRING} ^partnerid=part02324$ [NC]
RewriteRule ^/?$ [R=302,L]

In above, we are redirecting to a different path, if the query string has a specific parameter (partnerid=part02324). The [NC] in the above redirect stands for case insensitive search. R is status and L is last condition.

Could we have something similar in _redirects file. Unfortunately, I could not find any RegEx/Case sensitivity flag in the _Redirects documentation.

My Findings:
I believe “Edge Listeners” can be utilized for parameter checking. Requested for Edge Listeners (since its in early access).

from = “/partner”
to = “/home”
status = 200
force = false
query = {partnerid = “:partnerid”} # apply this rule for /?path=example
#conditions = {partnerid = “admin”} # NOT supported, wish list…
edge_handler = “verifyParamAndRedirect”

Without case insensitivity flag, it is going to be a pain, if we have to handle all the possible case matching for parameter “partnerid”. Case Insensitive flag support would be greatly appreciated.

As far as I’m aware, our redirects (and URLs in general) are not case sensitive?

Hi Pie,
Thank you. Yes, I realized it to be Case Insensitive.
I am able to achieve case insensitive parameter value redirect as follows:

from = “/third”
to = “/third-blog”
status = 301
force = true
query = {partnerid = “part02324”}

Test links ( Note the case in parameters and values):

Any possibility for RegEx support, (or) Edge handler is the only option for Regex.

Depending on what you’re doing, you could have a rule specifically for partnerid=admin, above a partnerid=:partnerid rule. We’ll check to see if partnerid equals admin and, if not, we’ll use the partnerid equals :partnerid rule.