Skip to main content
All CollectionsURL Redirect Test
How to Use URL Matching for URL Redirect Tests trigger condition
How to Use URL Matching for URL Redirect Tests trigger condition

This article will explain how to use URL matching patterns for your URL redirect experiments.

Annie at ABConvert avatar
Written by Annie at ABConvert
Updated over a month ago

URL redirect tests allow you to compare different versions of a page by sending visitors to alternate URLs. Proper URL matching is crucial for setting up effective redirect tests. This article will explain how to use URL matching patterns for your URL redirect experiments.

Understanding URL Structure

Before setting up URL matching, it's helpful to understand the basic structure of a URL:

https://www.example.com/products/category/item?color=blue#details

  • Protocol: https://

  • Path: /products/category/item

  • Query parameters: ?color=blue

  • Fragment: #details

URL Matching Patterns

ABConvert supports several URL matching patterns for redirect tests:

Starts with, Ends with

Matches URLs that start or end with the specified string. Ignores query parameters and fragments.

Example: /products

Will match:

Matches Exactly

Matches the entire URL exactly, including query parameters.

Example: /products?color=red

Will only match that exact URL.

Contains

Matches URLs that contain the specified string anywhere.

Example: products/shoes

Will match:

Matches Regex Exactly

Allows complex pattern matching using regex.

Example: ^https:\/\/www\.example\.com\/products\/[a-z-]+$

Will match:

But NOT:

Common Regex

Pattern

Description

Example

^

Matches the start of a string

^https:// matches URLs starting with https://

$

Matches the end of a string

\.html$ matches URLs ending with .html

.

Matches any single character

a.c matches "abc", "a1c", "a@c", etc.

*

Matches zero or more of the preceding character

ab*c matches "ac", "abc", "abbc", etc.

+

Matches one or more of the preceding character

ab+c matches "abc", "abbc", but not "ac"

?

Matches zero or one of the preceding character

colou?r matches "color" and "colour"

\d

Matches any digit (0-9)

\d{3} matches any three-digit number

\w

Matches any word character (a-z, A-Z, 0-9, _)

\w+ matches any word

\s

Matches any whitespace character

\s+ matches one or more spaces, tabs, or newlines

{n,}

Matches n or more occurrences of the preceding character

\d{2,} matches two or more digits

{n,m}

Matches between n and m occurrences of the preceding character

\d{2,4} matches between two and four digits

Comparison Chart

Here's a table using the URL https://abconvert-ob-test.myshopify.com/collections/all to demonstrate different match types:

URL Pattern

Starts With

Ends With

Matches Exactly

Matches Regex Exactly

Contains

/collections

V

X

X

X

V

/collections/all

V

V

V

V

V

collections

X

X

X

X

V

^https:\/\/abconvert-ob-test\.myshopify\.com\/collections\/[a-z]+$ (Regex)

X

X

X

Matches /collections/all

X

Best Practices

  • Start with simple matching when possible

  • Use Starts with or Ends with for pages with important query parameters

  • Test your matching patterns before launching the experiment

Troubleshooting

If your URL matching isn't working as expected:

  • Double-check for typos in your URL patterns

  • Ensure you've selected the correct matching method

  • Test with multiple sample URLs to verify the pattern

  • Use the ABConvert preview mode to test matching in real-time

By mastering URL matching patterns, you'll be able to set up precise and effective URL redirect tests across your website. Remember to monitor your tests closely and analyze the results to make data-driven decisions about your page variations.

If you have any questions or feedback, feel free to email support@abconvert or reach out through the support widget.

Happy testing πŸŽ‰

Did this answer your question?