Back to Docs

How to set up 301 redirects on LovableHTML

Guide for canonical domain redirects and page-level redirects. Why 301 is better than 302.

Why 301 redirects matter for SEO

A 301 redirect tells search engines that a page has permanently moved. This is important because:

  • SEO value transfers: ~90-99% of the old page's ranking power passes to the new URL
  • Index consolidation: Google eventually drops the old URL from its index and only shows the new one
  • Backlinks preserved: Links pointing to the old URL still count for the new page

In contrast, 302 (temporary) redirects don't pass SEO value and signal that the old page might come back.

Type 1: Canonical domain redirect

Choose whether your primary domain is the apex (example.com) or www (www.example.com). All traffic should redirect to one canonical version.

  1. Go to Site Settings
  2. Find the "Canonical Domain" section
  3. Select your preferred option:
    • example.com: Redirects www visitors to apex
    • www.example.com: Redirects apex visitors to www
    • Off: Serves both (not recommended for SEO)

Which should you choose? Either works for SEO. Pick apex (example.com) if you want shorter URLs. Pick www if you need cookie isolation for subdomains or CDN flexibility.

Type 2: Page-level redirects

Redirect specific paths when you rename, move, or merge pages.

  1. Go to Site Settings
  2. Find the "Redirects" section
  3. Add your redirect rules

Example redirect rule:

code.ts
CopyDownload
Path: /old-blog-post
Destination: /blog/new-post-title

Common use cases:

  • Renamed blog posts or pages
  • Changed URL structure (e.g., /posts/123 → /blog/post-title)
  • Merged content from multiple pages into one
  • Fixing URLs with typos that got indexed

Redirect chains to avoid

A redirect chain happens when one redirect leads to another redirect. For example:

code.ts
CopyDownload
/old-page → /middle-page → /final-page
❌ Bad: Two hops, SEO value dilutes at each step

Instead, always redirect directly to the final destination:

code.ts
CopyDownload
/old-page → /final-page
✓ Good: Single hop, maximum SEO value transfer

After adding redirects: Update your sitemap to remove the old URLs and ensure canonical tags point to the new URLs. If you previously submitted the old URLs to Search Console, the redirects will help Google discover the new locations.