LovableHTML is nowEncited.com
·Read the announcement →
encited logo
BlogAPI PlatformPricing

Set up 301 page redirects (path patterns & captures)

Forward old URLs to new ones with wildcard path patterns and $1, $2 captures. Includes exact-match redirects for legacy query strings.

What 301 redirects do here

Page-level 301 redirects forward a specific path (or pattern of paths) to a new destination. The redirect runs at the edge before Encited (formerly LovableHTML) renders anything, and applies equally to bots, crawlers, and human visitors.

A 301 tells search engines the move is permanent, so:

  • ~90–99% of the old URL's ranking power passes to the new URL
  • The old URL eventually drops out of the index
  • Existing backlinks count for the new page

302s don't pass ranking signal — only use one if the move is genuinely temporary.

This guide is for path redirects. For redirecting www.example.comexample.com, use the Primary domain setting instead — those two redirect types should not overlap.

Where to configure it

  1. Go to Site Settings
  2. Open the Redirects accordion under CACHE & ROUTING
  3. Click Add Redirect, fill in FROM and TO, save

The first matching rule wins, so order matters when patterns overlap.

Path patterns: * and **

Sources are matched by glob-style path patterns, not regex. Two wildcards are supported, and each one must be a whole path segment/blog/* is valid, /blog-* is not.

Token Matches Example
* One single path segment /blog/* matches /blog/hello but not /blog/2024/hello
** The rest of the path (zero or more segments) /old/** matches /old, /old/a, /old/a/b/c

Rules:

  • Patterns must start with /
  • ** may only appear as the last segment
  • Sources cannot contain ? or # unless you're using an exact-match query redirect

Capture placeholders: $1, $2, …

Every wildcard in the source becomes a numbered capture. Reference it in the destination with $N$1 is the first wildcard, $2 the second, and so on. ** captures the entire remaining path as a single string (without a leading slash).

Examples

Rename a path prefix and keep the rest:

FROMTO
/old-blog/**
/blog/$1

/old-blog/2024/seo-tips/blog/2024/seo-tips

Reorder URL segments:

FROMTO
/author/*/post/*
/post/$2/by/$1

/author/jane/post/intro/post/intro/by/jane

Collapse a category into a flat URL:

FROMTO
/category/*/item/*
/shop/$2

/category/shoes/item/red-runner/shop/red-runner

Redirect to an external site:

FROMTO
/docs/legacy/**
https://docs.legacy.example.com/$1

External destinations are always 301 (we won't issue a 307 to a different origin).

$N only works when the source has at least N wildcards. Referencing $2 against a source with one * is a save-time error. Patterns without wildcards have no captures to substitute.

Exact-match redirects for legacy query strings

Path patterns can't include ?, so to redirect a legacy URL like /old.asp?id=42 you need to put the full literal string (path + query) in the source. The redirect engine detects the ? and switches to exact-string matching for that rule — no wildcards, no captures.

FROMTO
/old.asp?id=42
/products/widget-42

This is the only way to discriminate between two URLs that share a path but differ on query — useful for migrating off .asp, .php, or any CMS that encoded IDs into the query string.

Captures don't work in exact-match rules. The destination cannot contain $1, $2, etc. when the source has a ? — there's nothing to capture. This is enforced at save time.

Avoid redirect chains

A chain happens when a redirect points to another redirect:

ts
CopyDownload
/old → /middle → /final

Each hop loses a small amount of ranking signal and adds latency. Always point directly to the final destination:

ts
CopyDownload
/old → /final
/middle → /final

If you've accumulated chains over the years, audit them with the SEO Spider — it flags multi-hop redirects.

Verify a redirect

bash
CopyDownload
curl -sI https://example.com/old-path
# Expect:
# HTTP/2 301
# location: /new-path

For redirects with captures, hit a path that exercises the wildcard:

bash
CopyDownload
curl -sI https://example.com/old-blog/2024/hello
# location: /blog/2024/hello

Common mistakes

  • Overlapping rules/blog/* and /blog/** will both match /blog/hello. The more specific rule should come first; first match wins.
  • Trailing slash mismatch/about and /about/ are different paths. Add separate rules or normalize on your origin.
  • Forgetting to update the sitemap — redirected URLs should be removed from the sitemap; the new URLs should be in it.
  • Redirecting to a 404 — we don't validate that the destination exists. Test the new URL before you ship the rule.
Avatar
How can we help?
Get instant answers to your questions or leave a message for an engineer will reach out
Ask AI about LovableHTML
See our docs
Contact support
Leave a message
We'll get back to you soon
Avatar
Ask AI about LovableHTML
Team is also here to help
Thinking
Preview
Powered by ReplyMaven
Avatar
Aki
Hi, need help with SEO, AI search or getting indexed?