HTTP Redirects for SEO in Nuxt

301 redirects preserve SEO value when content moves. Nuxt handles server-side redirects through routeRules to pass link equity and maintain rankings.
Harlan WiltonHarlan Wilton9 mins read Published Updated
What you'll learn
  • 301 redirects pass ~100% link equity—use for permanent content moves
  • Server-side redirects required—JavaScript redirects don't pass SEO value
  • Avoid redirect chains (A→B→C)—redirect directly to the final destination

301 redirects pass nearly 100% of link equity to the new URL (Google confirms), preserving your SEO value when content moves. Server-side implementation required for search engines to recognize them.

Use for permanent moves: site migrations, URL restructuring, domain changes, deleted pages with replacements. For duplicate content use canonical tags. For temporary moves use 302 redirects.

Quick Setup

Nuxt handles redirects through routeRules in your config or server middleware:

export default defineNuxtConfig({
  routeRules: {
    '/old-page': { redirect: { to: '/new-page', statusCode: 301 } },
    '/blog/**': { redirect: '/articles/**' }
  }
})

301 vs 302 Redirects

When to Use Each

301 (Permanent) - Transfers ~100% of link equity to new URL (Google)

  • Permanent content moves
  • Domain migrations
  • URL structure changes
  • Deleted pages with direct replacements
  • HTTP to HTTPS upgrades

302 (Temporary) - Keeps SEO value on original URL

  • A/B testing
  • Temporary promotions
  • Maintenance pages
  • Out-of-stock product redirects

If a 302 stays active for months with no plans to revert, switch to 301 (SEO Clarity). Search engines may eventually treat long-term 302s as permanent anyway.

307/308 - Like 302/301 but preserve HTTP method (POST remains POST). Rarely needed for typical SEO work.

How Long to Keep Redirects Active

Google recommends keeping 301 redirects active for at least one year (Search Central). This ensures Google transfers all ranking signals and recrawls links pointing to old URLs.

Keep redirects longer if:

  • External sites still link to old URLs
  • Old URLs receive referral traffic
  • High-value pages with many backlinks

Removing redirects before Google processes them loses the transferred SEO value permanently.

Avoid Redirect Chains

Redirect chains (A → B → C) waste crawl budget and slow page speed (Gotch SEO). Each hop degrades Core Web Vitals, particularly LCP and TTFB.

Google follows up to 5 redirect hops, then aborts (Hike SEO). Redirect directly to final destination:

Bad:

/old → /interim → /final

Good:

/old → /final
/interim → /final

Common Patterns

Domain Migration

export default defineNuxtConfig({
  routeRules: {
    // Redirect entire old domain to new domain
    '/**': {
      redirect: {
        to: path => `https://new-domain.com${path}`,
        statusCode: 301
      }
    }
  }
})

URL Structure Changes

export default defineNuxtConfig({
  routeRules: {
    '/old': { redirect: { to: '/new', statusCode: 301 } },
    '/blog/**': { redirect: '/articles/**' },
    '/products/**': { redirect: '/shop/**' }
  }
})

HTTPS Enforcement

export default defineNuxtConfig({
  routeRules: {
    '/**': {
      headers: {
        'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
      }
    }
  }
})

Learn more about HTTPS in our security guide.

WWW Standardization

export default defineNuxtConfig({
  routeRules: {
    '/**': {
      redirect: {
        to: (path, { host }) => {
          if (!host?.startsWith('www.')) {
            return `https://www.${host}${path}`
          }
        },
        statusCode: 301
      }
    }
  }
})

Testing Redirects

Verify redirects work correctly before deploying:

  1. Check status code - Use browser dev tools Network tab, confirm 301 or 302
  2. Test destination - Ensure redirect points to correct final URL
  3. Verify no chains - Confirm single hop to destination
  4. Test trailing slashes - Check with and without trailing slash
  5. Check query parameters - Verify parameters carry over if needed

Tools

  • Google Search Console - Monitor crawl errors and redirect issues
  • Browser Dev Tools Network tab - Check status codes and headers
  • Screaming Frog - Bulk redirect testing and chain detection
  • curl - curl -I https://example.com/old-page shows redirect headers

Common Mistakes

Redirecting to Irrelevant Pages

Redirecting deleted pages to your homepage damages SEO and user experience. Google may treat this as a soft 404, ignoring link equity transfer (Victorious).

nuxt.config.ts
export default defineNuxtConfig({
  routeRules: {
    // ❌ Bad - mass redirects to homepage
    '/blog/**': { redirect: '/' },

    // ✅ Good - redirect to relevant content
    '/blog/vue-tips': { redirect: '/articles/vue-tips' },
    '/blog/seo-guide': { redirect: '/articles/seo-guide' }
  }
})

Redirect Loops

Circular redirects break your site:

nuxt.config.ts
export default defineNuxtConfig({
  routeRules: {
    // ❌ Bad - creates infinite loop
    '/page-a': { redirect: '/page-b' },
    '/page-b': { redirect: '/page-a' },

    // ✅ Good - both redirect to final destination
    '/page-a': { redirect: '/final' },
    '/page-b': { redirect: '/final' }
  }
})

Using Client-Side Redirects for SEO

JavaScript redirects don't pass link equity reliably. Search engines may not execute JavaScript before indexing. Always use server-side redirects (301/302 status codes) for SEO purposes.

Relying on redirects for internal links wastes server resources and slows page speed. Update internal links to point directly to new URLs, keep redirects for external links and old bookmarks.