Redirects
Admin → Redirects (/admin/redirects, admins only) sends old addresses and extra domains to
their new home with a 301, so search rankings and traffic from inbound links follow, like
WordPress's Redirection plugin without installing one. Changes reach every node within about a
minute, no deploy.
Domains (one site, many domains)
When a site answers on several domains (an old brand, other TLDs, with and without www):
| Source domain | Primary domain | Result |
|---|---|---|
old-brand.com | www.example.com | old-brand.com/us/about?x=1 and www.old-brand.com/... → https://www.example.com/us/about?x=1 |
* | www.example.com | every domain except the primary one (local development, *.pages.dev previews and IP addresses excluded), e.g. to settle on www or the bare domain |
- Path and query are kept; 301 (permanent) by default, 302 / 307 / 308 possible.
- Pages and the admin move;
/api/**,/_nuxt/**and other APIs and assets do not (payment callbacks, cron and reverse proxies keep working). - The domains must point at this site (a Cloudflare Pages custom domain, nginx
server_name, ...). On Cloudflare Pages this is more reliable than a "Forwarding URL" page rule, which Pages custom domains bypass. - E-mail (MX) is unaffected; only HTTP requests are redirected.
The same can be set with an environment variable (baked in at build time; works together with the admin rules):
NUXT_HOST_REDIRECTS="old-brand.com>www.example.com,alias.fi>www.example.com>302"
URL redirects
| Source | Target | Notes |
|---|---|---|
/old-page | /us/new-page | exact, case and trailing / ignored; the visitor's query (?utm_source=) is passed on |
/blog/* | /us/posts/* | a trailing * matches a whole folder; the rest of the path is carried over |
/?p=123 | /us/posts/hello | a source with a query matches exactly that query (old WordPress links) |
/removed-product | (410) | gone for good: search engines drop it |
/产品 | https://shop.example.com/ | non-ASCII paths and full URLs work |
- Admin, API and asset paths and the home page cannot be sources; targets cannot be
javascript:or other unsafe links, nor the source itself. - Bulk import: one
source target [status]per line, separated by spaces, tabs or commas; a CSV export of another redirect plugin works when its first columns are source and target. Existing sources are skipped. - Test: enter a URL or path to see where it goes.
- Every rule shows its hits and last hit (written in batches each minute).
404 log
Switched on under "404 log", page paths that answered 404 are recorded (hits, referring page,
last seen; no IP addresses). Sort by hits to find old links that still need a redirect and add
one with a click. Common bot probes (/wp-login.php, .env, .php, ...) are ignored; at most
5,000 entries, and entries unseen for 90 days are removed by the cron. Off by default.