HTTP Redirects for SEO in Nuxt · Nuxt SEO

[NuxtSEO](https://nuxtseo.com/ "Home")

- [Modules](https://nuxtseo.com/docs/nuxt-seo/getting-started/introduction)
- [Tools](https://nuxtseo.com/tools)
- [Pro](https://nuxtseo.com/pro)
- [Learn SEO](https://nuxtseo.com/learn-seo/nuxt) [Releases](https://nuxtseo.com/releases)

[1.4K](https://github.com/harlan-zw/nuxt-seo)

[Nuxt SEO on GitHub](https://github.com/harlan-zw/nuxt-seo)

Learn SEO

Master search optimization

Nuxt

 Vue

[SEO Checklist](https://nuxtseo.com/learn-seo/checklist) [Pre-Launch Warmup](https://nuxtseo.com/learn-seo/pre-launch-warmup) [Backlinks & Authority](https://nuxtseo.com/learn-seo/backlinks)

[Mastering Meta](https://nuxtseo.com/learn-seo/nuxt/mastering-meta)

- [Titles](https://nuxtseo.com/learn-seo/nuxt/mastering-meta/titles)
- [Meta Description](https://nuxtseo.com/learn-seo/nuxt/mastering-meta/descriptions)
- [Image Alt Text](https://nuxtseo.com/learn-seo/nuxt/mastering-meta/alt-text)
- [Social Sharing](https://nuxtseo.com/learn-seo/nuxt/mastering-meta/open-graph)
- [Rich Results](https://nuxtseo.com/learn-seo/nuxt/mastering-meta/rich-results)
- [Schema.org](https://nuxtseo.com/learn-seo/nuxt/mastering-meta/schema-org)
- [Twitter Cards](https://nuxtseo.com/learn-seo/nuxt/mastering-meta/twitter-cards)

[ Controlling Crawlers](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers)

- [Robots Txt](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/robots-txt)
- [Sitemaps](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/sitemaps)
- [Robot Meta Tag](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/meta-tags)
- [Canonical Link Tag](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/canonical-urls)
- [HTTP Redirects](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/redirects)
- [Duplicate Content](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/duplicate-content)
- [llms.txt](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/llms-txt)

[ Routes & Rendering](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering)

- [URL Structure](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/url-structure)
- [Pagination](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/pagination)
- [Trailing Slashes](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/trailing-slashes)
- [Query Parameters](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/query-parameters)
- [Hreflang & i18n](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/i18n)
- [404 Pages](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/404-pages)
- [Dynamic Routes](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/dynamic-routes)
- [Internal Linking](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/internal-linking)
- [Programmatic SEO](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/programmatic-seo)
- [Rendering Modes](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/rendering)
- [Security](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/security)

[ Launch & Listen](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen)

- [Getting Indexed](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/going-live)
- [Google Search Console](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/search-console)
- [Core Web Vitals](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/core-web-vitals)
- [Indexing Issues](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/indexing-issues)
- [SEO Monitoring](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/seo-monitoring)
- [Site Migration](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/site-migration)
- [IndexNow](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/indexnow)
- [Debugging](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/debugging)
- [AI Search Optimization](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/ai-optimized-content)

1. [Learn SEO for Nuxt](https://nuxtseo.com/learn-seo)
2.
3. [Controlling Crawlers](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers)
4.
5. [Redirects](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/redirects)

# 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 Wilton](https://avatars.githubusercontent.com/u/5326365?v=4)Harlan Wilton](https://x.com/harlan-zw)9 mins read Published Nov 3, 2024 Updated Jan 29, 2026

What you'll learn

- 301 redirects pass ~100% link equity. use for permanent content moves
- In 2026, redirects are critical for preserving visibility in AI search during migrations
- 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, preserving your SEO value and **AI Search Visibility** when content moves. In 2026, a botched migration without proper redirects can lead to a total loss of citation in AI-generated answers.

Use for permanent moves: site migrations, URL restructuring, domain changes, deleted pages with replacements. For duplicate content use [canonical tags](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/canonical-urls). For temporary moves use 302 redirects.

## [Quick Setup](#quick-setup)

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

nuxt.config.ts

server/middleware/redirects.ts

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

```
export default defineEventHandler((event) => {
  if (event.path === '/old-page') {
    return sendRedirect(event, '/new-page', 301)
  }
  if (event.path.startsWith('/blog/')) {
    const slug = event.path.replace('/blog/', '')
    return sendRedirect(event, \`/articles/${slug}\`, 301)
  }
})
```

## [301 vs 302 Redirects](#_301-vs-302-redirects)

### [When to Use Each](#when-to-use-each)

**301 (Permanent)** - Transfers ~100% of link equity to new URL ([Google](https://www.searchenginejournal.com/301-redirect-pagerank/275503/))

- 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](https://www.seoclarity.net/resources/knowledgebase/use-301-redirect-vs-302-redirect-15683/)). 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](#how-long-to-keep-redirects-active)

Google recommends keeping 301 redirects active for at least one year ([Search Central](https://www.searchenginejournal.com/google-keep-301-redirects-in-place-for-a-year/428998/)). 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](#avoid-redirect-chains)

Redirect chains (A → B → C) waste [crawl budget](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers#crawler-budget) and slow page speed ([Gotch SEO](https://www.gotchseo.com/redirect-chains/)). Each hop degrades [Core Web Vitals](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen/core-web-vitals), particularly LCP and TTFB.

Google follows up to 5 redirect hops, then aborts ([Hike SEO](https://developers.google.com/search/docs/crawling-indexing/301-redirects#redirect-chains)). Redirect directly to final destination:

Bad:

```
/old → /interim → /final
```

Good:

```
/old → /final
/interim → /final
```

## [Common Patterns](#common-patterns)

### [Domain Migration](#domain-migration)

nuxt.config.ts

server/middleware/domain.ts

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

```
export default defineEventHandler((event) => {
  const host = getRequestHost(event)
  if (host === 'old-domain.com') {
    return sendRedirect(event, \`https://new-domain.com${event.path}\`, 301)
  }
})
```

### [URL Structure Changes](#url-structure-changes)

nuxt.config.ts

server/middleware/redirects.ts

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

```
export default defineEventHandler((event) => {
  if (event.path === '/old') {
    return sendRedirect(event, '/new', 301)
  }
  if (event.path.startsWith('/blog/')) {
    const slug = event.path.replace('/blog/', '')
    return sendRedirect(event, \`/articles/${slug}\`, 301)
  }
  if (event.path.startsWith('/products/')) {
    const id = event.path.replace('/products/', '')
    return sendRedirect(event, \`/shop/${id}\`, 301)
  }
})
```

### [HTTPS Enforcement](#https-enforcement)

nuxt.config.ts

server/middleware/https.ts

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

```
export default defineEventHandler((event) => {
  if (getHeader(event, 'x-forwarded-proto') !== 'https') {
    const host = getRequestHost(event)
    return sendRedirect(event, \`https://${host}${event.path}\`, 301)
  }
})
```

Learn more about HTTPS in our [security guide](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/security).

### [WWW Standardization](#www-standardization)

nuxt.config.ts

server/middleware/www.ts

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

```
export default defineEventHandler((event) => {
  const host = getRequestHost(event)
  if (!host.startsWith('www.')) {
    return sendRedirect(event, \`https://www.${host}${event.path}\`, 301)
  }
})
```

## [Testing Redirects](#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](#tools)

- [Google Search Console](https://search.google.com/search-console) - Monitor crawl errors and redirect issues
- Browser Dev Tools Network tab - Check status codes and headers
- [Screaming Frog](https://www.screamingfrog.co.uk/seo-spider/) - Bulk redirect testing and chain detection
- curl - `curl -I https://example.com/old-page` shows redirect headers

## [Common Mistakes](#common-mistakes)

### [Redirecting to Irrelevant Pages](#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](https://developers.google.com/search/docs/crawling-indexing/soft-404-errors)).

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](#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](#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.

### [Not Updating Internal Links](#not-updating-internal-links)

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.

[The 2026 SEO Checklist for Nuxt & Vue Pre-launch setup, post-launch verification, and ongoing monitoring. Interactive checklist with links to every guide.](https://nuxtseo.com/learn-seo/checklist) [Haven't launched yet? Start with the Pre-Launch Warmup](https://nuxtseo.com/learn-seo/pre-launch-warmup)

---

[Canonical Link Tag Canonical URLs tell search engines which version of a page to index when duplicate content exists. Here's how to set them up in Nuxt.](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/canonical-urls) [Duplicate Content Duplicate content wastes crawl budget and splits ranking signals. Here's how to find and fix it with canonical tags, redirects, and parameter handling.](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers/duplicate-content)

On this page

- [Quick Setup](#quick-setup)
- [301 vs 302 Redirects](#_301-vs-302-redirects)
- [Common Patterns](#common-patterns)
- [Testing Redirects](#testing-redirects)
- [Common Mistakes](#common-mistakes)

[GitHub](https://github.com/harlan-zw/nuxt-seo) [ Discord](https://discord.com/invite/275MBUBvgP)

### [NuxtSEO](https://nuxtseo.com/ "Home")

- [Getting Started](https://nuxtseo.com/docs/nuxt-seo/getting-started/introduction)
- [MCP](https://nuxtseo.com/docs/nuxt-seo/guides/mcp)

Modules

- [Robots](https://nuxtseo.com/docs/robots/getting-started/introduction)
- [Sitemap](https://nuxtseo.com/docs/sitemap/getting-started/introduction)
- [OG Image](https://nuxtseo.com/docs/og-image/getting-started/introduction)
- [Schema.org](https://nuxtseo.com/docs/schema-org/getting-started/introduction)
- [Link Checker](https://nuxtseo.com/docs/link-checker/getting-started/introduction)
- [SEO Utils](https://nuxtseo.com/docs/seo-utils/getting-started/introduction)
- [Site Config](https://nuxtseo.com/docs/site-config/getting-started/introduction)
- [Skew Protection](https://nuxtseo.com/docs/skew-protection/getting-started/introduction)
- [AI Ready](https://nuxtseo.com/docs/ai-ready/getting-started/introduction)

### [NuxtSEO Pro](https://nuxtseo.com/pro "Nuxt SEO Pro")

- [Getting Started](https://nuxtseo.com/pro)
- [Dashboard](https://nuxtseo.com/pro/dashboard)
- [Pro MCP](https://nuxtseo.com/pro/docs/getting-started/mcp-setup)

### [Learn SEO](https://nuxtseo.com/learn-seo "Learn SEO")

Nuxt

- [Mastering Meta](https://nuxtseo.com/learn-seo/nuxt/mastering-meta)
- [Controlling Crawlers](https://nuxtseo.com/learn-seo/nuxt/controlling-crawlers)
- [Launch & Listen](https://nuxtseo.com/learn-seo/nuxt/launch-and-listen)
- [Routes & Rendering](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering)
- [Staying Secure](https://nuxtseo.com/learn-seo/nuxt/routes-and-rendering/security)

Vue

- [Vue SEO Guide](https://nuxtseo.com/learn-seo/vue)
- [Mastering Meta](https://nuxtseo.com/learn-seo/vue/mastering-meta)
- [Controlling Crawlers](https://nuxtseo.com/learn-seo/vue/controlling-crawlers)
- [SPA SEO](https://nuxtseo.com/learn-seo/vue/spa)
- [SSR Frameworks](https://nuxtseo.com/learn-seo/vue/ssr-frameworks)
- [SEO Checklist](https://nuxtseo.com/learn-seo/checklist)
- [Pre-Launch Warmup](https://nuxtseo.com/learn-seo/pre-launch-warmup)
- [Backlinks & Authority](https://nuxtseo.com/learn-seo/backlinks)

### [Tools](https://nuxtseo.com/tools "SEO Tools")

- [Social Share Debugger](https://nuxtseo.com/tools/social-share-debugger)
- [Robots.txt Generator](https://nuxtseo.com/tools/robots-txt-generator)
- [Meta Tag Checker](https://nuxtseo.com/tools/meta-tag-checker)
- [HTML to Markdown](https://nuxtseo.com/tools/html-to-markdown)
- [XML Sitemap Validator](https://nuxtseo.com/tools/xml-sitemap-validator)
- [Schema.org Validator](https://nuxtseo.com/tools/schema-validator)
- [Keyword Idea Generator](https://nuxtseo.com/tools/keyword-generator)
- [Keyword Research](https://nuxtseo.com/tools/keyword-research)
- [SERP Analyzer](https://nuxtseo.com/tools/serp-analyzer)
- [Domain Rankings](https://nuxtseo.com/tools/domain-rankings)

Copyright © 2023-2026 Harlan Wilton - [MIT License](https://github.com/harlan-zw/nuxt-seo/blob/main/license) · [mdream](https://mdream.dev)