Dynamic destinations

By utilizing dynamic destinations, you can define complex traffic routing rules based on your incoming traffic. All dynamic destination redirects work with automatic HTTPS. Available from our Pro plan and up.

Dynamic destinations operate by defining multiple destinations on a single redirect, each with a unique expression. This expression determines if the destination should be used for the incoming request.

For example, do you wish to redirect all US traffic to 'new-website.us', and all other traffic to 'new-website.com'? Or perhaps you desire to redirect all traffic before 12:00 to Destination A, and afternoon traffic to Destination B? These configurations are achievable by defining custom expressions.

This support article explains the available options which can be used in your expression.

Parameters

You may use all destination variables as parameters in your expression, for instance:

domain.fqdn - example: www.redirect-me-plz.co.uk
domain.label - example: www.redirect-me-plz
domain.root - example: redirect-me-plz
domain.extension - example: co.uk
domain.subdomain - example: www
path - example: contact
country - example: US
method - example: POST
userAgent - example: Mozilla/5.0 (iPad; U; CPU.....)
scheme - example: https

See all destination variables that can be used here. The domain.subdomain variable is especially useful when combined with wildcard subdomains to route traffic based on the incoming subdomain.

You can also use regex capture groups:

$1 // Regex capture group 1
$2 // etc.

On top of these variables, the following functions are available:

now() // UTC unix timestamp to be used to compare dates or time
time('15:00') // UTC timezone
time('15:00', 'Europe/Amsterdam') // Specify timezone via second parameter
datetime('2023-01-01') // UTC timezone
datetime('2023-01-01 15:00') // UTC, with time
datetime('2023-01-01 15:00', 'Europe/Amsterdam') // Amsterdam timezone

Date comparison

You can define date objects with the `datetime` function:

datetime('2023-01-01') < time()

The code above uses the UTC timezone. If you wish to specify your own timezone, you can wrap the date (with or without time) in the `datetime` method:

datetime('2023-01-01 15:00', 'America/New_York') // Specify timezone via second parameter

Random comparison

To steer traffic on a random basis, you can use the random function. This method accepts `min` and `max` integer values, which you can compare. For example, if you want to redirect 70% of the traffic to destination A and 30% to destination B, you can use the following approach:

random(1, 100) <= 70

Use this for A/B testing landing pages or gradual migrations. Track the results in your redirect analytics to see which destination performs better.

Expression

The order of the defined destinations are important. The first expression that matches the incoming request will be used. To match all requests for a "fallback" destination, you keep the expression empty. An empty expression will always result in a match.

The expression is evaluated by the powerful golang `expr` package. Read more about the many options here.

Examples

Example 1

Source: source.com
Destination 1:
  URL: destination.us
  Expression: country == 'US'
Destination 2:
  URL: destination.com
  Expression: ''

When traffic from the US comes in, the visitor is redirected to destination.us. All other traffic will match the expression '*', and is redirected to destination.com.

Example 2

Source: source.com
Destination 1:
  URL: launching-soon.com
  Expression: datetime('2023-01-01 12:00', 'America/New_York') > now()
Destination 2:
  URL: new-website.com
  Expression: ''

When traffic before the 1st of January 2023 and 12:00 NY timezone comes in, it's redirected to launching-soon.com. Traffic after the 1st of January 2023 and 12:00 NY time, will be redirected to the new-website.com

Example 3

Source: source.com
Destination 1:
  URL: destination-before-12.com
  Expression: time('12:00') < now()
Destination 2:
  URL: destination-after-12.com
  Expression: time('12:00') >= now()

When traffic before 12:00 comes in, the visitor is redirected to destination-before-12.com. Traffic after 12:00 will be redirected to destination-after-12.com.

Time is automatically determined based on the UTC timezone. You may define a second parameter to the `time` function to specify your local timezone for easier readability.

More articles

Walkthroughs
GoDaddy: Forwarding with HTTPS support
Network Solutions: Forwarding with HTTPS support
Namecheap: Forwarding with HTTPS support
Hover: Forwarding with HTTPS support
TransIP: Forwarding with HTTPS support
Cloudflare: Forwarding with HTTPS support
Amazon Route 53: Forwarding with HTTPS support
NS1: Forwarding with HTTPS support
DigitalOcean: Forwarding with HTTPS support
Google Cloud DNS: Forwarding with HTTPS support
EuroDNS: Forwarding with HTTPS support
Azure DNS: Forwarding with HTTPS support
DNS Made Easy: Forwarding with HTTPS support
Freenom: Forwarding with HTTPS support
Mijndomein: Forwarding with HTTPS support

Domain redirects delivered hassle-free

Get started right away

  • Free plan
  • No creditcard required

redirect.pizza has all your favorite ingredients

Analytics

Who is still visiting those old domains? Gain valuable insight with detailed statistics and find out where the hits are coming from.

Learn more

API

Connect your software to automatically create redirects via our API. Automation makes your life easier.

Learn more

Destination Variables

You control how we handle your destination URL. Want to include your domain extension as a query string parameter? No problem.

Learn more

Dynamic destinations

Steer your traffic to different destinations, based on rules you define.

Learn more

Path forwarding

Keep the original path and keep it in the destination for a smooth domain migration and keeping your SEO game intact.

Learn more

Query Parameter Forwarding

Forward query parameters found on the source URL to the destination.

Learn more

Multiple Redirect Types

Choose the status code that works for you. Choose 301/307 (permanent), 302/308 (temporary) or frame your destination.

Learn more

Team management

Doing things all by yourself isn't much fun. Invite your co-workers to manage the redirects and work as a team.

Learn more

Automatic DNS

Integrate directly with your DNS provider, and apply the DNS changes from one platform.

Learn more

QR code generator

Create a QR code that you can use for marketing purposes. You can change the destination anytime after printing.

Learn more

Import & Export

Manage your redirects without losing precious time. Import and export redirects in our UX-friendly interface.

Global edge network

Redirecting in a blink of an eye; processing millions of request per hour in milliseconds.

Learn more

Broken destination monitor

Automatically checking your destinations to ensure it's reachable for everyone.

Learn more

Privacy First

We're based in Europe and are fully compliant with GDPR. Privacy-first!

Learn more

Wildcard subdomains

For when your domain utilizes a lot of different subdomains. Cover all subdomains with a single redirect.

Learn more

Tags

Group your redirects by adding tags. Keep everything organized and easy to find.

Bulk actions

Want to apply the same action for multiple redirects in one go? Do yourself a favor and start using bulk actions.

Dark mode

Give your eyes some well deserved rest by using the dark mode. Sync with your system or choose manually.

HSTS

Enable HSTS (HTTP Strict Transport Security) on team or domain level for an extra layer of protection.

Learn more

Change Destination Anytime

Once you're set up, you can change the destination URL anytime you want, and see the change in real-time.

Two-Factor Authentication

Secure your account with TOTP two-factor authentication. Scan the QR code, setup your app of choice, and you're safe(er).

Learn more

IDN Support

Add international hostnames with non-Latin characters. We ❤ that.

Support

Chat away! We're happy to help set up your account and answer your questions.