Skip to content

Redirects

Redirects allow you to forward visitors from one URL to another. We support Regular Expressions (regex) in our redirects tool.

Redirects work by specifying source and destination URLs in the dashboard. These URLs are relative to the main domain, so /home is equal to https://yourdomain.com/home.

Below we explain how to add a redirect, as well as some of the common types you may encounter.

Add a redirect

Redirects can be accessed from the site settings page. To access this, click the menu in the right hand side of a site card and then "settings".

Alt text

You will see a list of any existing redirects. Click "Create redirect" to add a new one.

Alt text

  • Source: The URL you wish to redirect from. This should be specified as a regular expression, starting with ^ and ending in $.
  • Destination: This should be the URL you wish to redirect to. Regular expressions are also supported here. You can also specify a full URL (with https:// at the start) if you wish to redirect to a different site.
  • Type: Choose from 301 (permenant) or 302 (temporary) depending on your needs.

Edit or Delete redirects

You can modify or remove a redirect from the redirects page. Changes are applied immediately.

Browser caching can intefere with redirects

Browsers often cache permanent redirects (301) aggressively. If you are making changes or deleting a redirect and it does not appear to be taking effect, try clearing your browser cache.

About regular expressions

A regular expression (regex) is a sequence of characters that define a search pattern. Regular expressions allow you to create flexible redirects but can be confusing to get to grips with.

Below we've provided some common regex syntax examples and some guidance on using them. Note that the order in which you add a redirect is the order in which they are executed.

Here’s some common regex syntax:

Syntax Description
^ Denotes the beginning of the line
$ Denotes the end of the line
? Match the previous 0 or 1 times
. Match any single character
* Match the previous 0 or more times
.* Match any character 0 or more times (wildcard)
.* Wildcard to match anything (any character which will match any string)
(.*) Capturing group - contains a wildcard match for any string in the given location

Examples

Simple page redirect

Redirect https://yourdomain.com/old-url to https://yourdomain.com/new-url:

  • Source: ^/old-url$
  • Destination: /new-url

Redirect non-www to www (preserving path)

Redirect https://yourdomain.com/anyurl to https://www.yourdomain.com/anyurl

  • Source: /(.*)$
  • Destination: https://www.domain.com/$1

Redirect all URLs to a new domain (preserving path)

Redirect any URL on your website to it's equivalent on www.newdomain.com:

  • Source: ^(.*)$
  • Destination: https://www.newdomain.com/$1

Wildcard redirect (match multiple URLs)

Redirect https://yourdomain.com/blog/anything to https://yourdomain.com/newblog/anything, preserving the path:

  • Source: ^/blog/(.*)$
  • Destination: /newblog/$1

Troubleshooting

ERR_TOO_MANY_REDIRECTS

This is called an infinite redirect loop, and it usually indicates a problem with the rules you've created. You should review each redirect to ensure they do not interact in a way that might cause a loop.

Common causes include:

  • When the target URL is included in both the Source and Destination.
  • Not using the $ symbol at the end of the Source field.