When a request comes in, redirect.pizza has to decide which of your redirects applies. This article explains the order in which we look for a match, and what happens when nothing matches.
Matching order
We compare the incoming URL with your sources in the following order and use the first match:
- Exact match, case sensitive: example.com/PaTh?query-string=1
- Exact match, case insensitive: example.com/path?query-string=1
- Path without the query string: example.com/path
- Hostname only, without a path: example.com
Regex sources and wildcard subdomains take part in the same process.
If none of these match, we don't know where to send the visitor and serve a 404 page. That's why we recommend always adding a root path redirect for every hostname: a source without a path, such as example.com. It acts as the fallback for every URL you didn't define explicitly.
Root requests prefer sources without path forwarding
When a request comes in for the root of a hostname (the homepage) and two sources qualify, we prefer the one with path forwarding disabled. This lets you send the homepage somewhere specific while every other path is forwarded:
- Redirect 1:
example.comtohttps://new.com, path forwarding on - Redirect 2:
example.comtohttps://new.com/new-homepage, path forwarding off
A request for example.com is redirected to https://new.com/new-homepage. A request for example.com/about is redirected to https://new.com/about.
When there's no match
Path not found
Say you have these redirects:
example.com to https://new-domain.com example.com/contact to https://new-domain.com/contact-us
A visitor of example.com/contact is redirected to https://new-domain.com/contact-us: an exact match.
A visitor of example.com/old-contact-page has no exact match. We move down the list and find the root source example.com, so the visitor is redirected to https://new-domain.com. Because of this fallback, your visitors never see a 404 page as long as a root path redirect exists. The interface suggests one automatically when it's missing:

This fallback is also why we don't offer a custom 404 page: with a root path redirect in place, it's never shown. Have a use case where you do need one? Let us know.
Hostname not found
When the hostname itself isn't set up in redirect.pizza, we have no redirect to fall back on and serve a "404 not found" page. Want that page to carry your own branding instead of ours? That's possible with a dedicated IP.