With redirects, you can redirect one URL on your website to another. For example, when you create a redirect from /foo
to /bar
, people who visit www.mydomain.com/foo
will be redirected automatically to www.mydomain.com/bar
.
Go to Settings → Redirects to create redirects for your project. They have 3 properties:
- From: the URL to redirect from. Always starts with a slash and never includes the domain name. Can contain wildcards (see below).
-
To: the URL to redirect to. To redirect to an external URL, start with
http://
orhttps://
, otherwise start with a slash. - Permanent: when checked, a permanent redirect will be executed with a 301 code, which will tell Google this redirect is permanent and they can forget about the source URL. Otherwise, the redirect will be temporary and a 302 code will be used.
When you add a query string when using the redirect, it will be added to the target URL. When the target URL itself also contains a query string, the two will be merged.
Note that redirects always have priority over pages. If both a redirect and a page exist with the same URL, the redirect will be executed and the page will not be reachable. In such cases, a warning will be shown in the page table.
You can use wildcards in the From field of redirects. There are 2 types:
-
*
matches all characters, except slash -
**
matches all characters, including slash
Let's have a look at some examples:
From | Will redirect? |
---|---|
/products/* |
✅ /products/category ❌ /products/category/product
|
/products/*/product |
✅ /products/category/product ❌ /products/category/subcategory/product
|
/products/** |
✅ /products/category ✅ /products/category/product
|
/products/**/product |
✅ /products/category/product ✅ /products/category/subcategory/product
|
You can export and import redirects in the same way you export and import data in tables.