# LEGACY REDIRECT MAP — mercadodevida.es → new-mercadodevida

**Legacy site**: OpenCart-based (evidenced by `?route=` URL patterns)
**New site**: Next.js App Router
**Status**: PARTIAL — requires completion after legacy site full audit

---

## How to Complete This Map

1. Fetch the full sitemap: `https://mercadodevida.es/sitemap.xml`
2. Fetch the homepage and parse all footer/navigation links
3. Check robots.txt disallows for route patterns
4. Map each discovered URL to its new equivalent

---

## Confirmed Redirects

| Legacy URL | New URL | Type | Status |
|-----------|---------|------|--------|
| `/quienes-somos` | `/about` | 308 | Confirmed from page content |
| `/quienes-somos` | `/about` | 308 | Confirmed from sitemap/links |
| `/contacto` | `/contact` | 308 | Confirmed from links |
| `/terminos-y-condiciones` | `/terms` | 308 | Confirmed from sitemap |
| `/politica-de-cookies` | `/cookies` | 308 | New route; no legacy page found (404) |
| `/politica-de-privacidad` | `/privacy` | 308 | New route; no legacy page found (404) |

---

## Product Redirects (from sitemap)

All product pages use slug format: `/[product-name-slug]`

From sitemap, product slugs look like:
```
/alga-dulse-hojas-100-gr-algamar
/arroz-lentejas-algas-eco-500-gr-algamar
/crema-de-cacahuetes-330gr-bio-monki
/semillas-de-calabaza-bio-250gr-el-granero-integral
/tahini-crema-de-sesamo-bio-340-gr-granovita
```

**Strategy**: 308 redirect ALL legacy product slugs to `/products/[slug]`

The new platform's product slugs may differ. Two approaches:

### Option A: Keep legacy slugs as canonical
- New platform generates slugs from product names
- If a legacy slug matches, it becomes the new canonical slug
- Redirect from legacy slug to new slug

### Option B: 308 everything to /products
- All legacy product URLs → `/products`
- User searches from there
- Simpler but loses SEO equity

**Recommended**: Option A if new product slugs can be configured. Otherwise Option B.

---

## Category Redirects

Legacy OpenCart category URLs use `?route=product/category&path=N` pattern.

From homepage navigation (extracted from page HTML):
```
/alimentacion
/aceites-y-vinagres
/azucares-y-endulzantes
/bebidas
/cereales-y-harinas
/chocolates-y-dulces
/especias-y-condimentos
/frutos-secos-y-semillas
/infantil
/infusiones-y-te
/legumbres
/macbiotica
/panaderia-y-galletas
/pastas-y-arrozes
/snacks
/cosmetica
/aseo-personal
/bebes-y-ninos
/corporal
/facial
/herbolario
/hogar
/mascotas
/libros
/superfood
```

**Strategy**: 308 redirect each legacy category slug to `/categories/[slug]`

---

## Static Pages Not Yet Confirmed

| Legacy URL | New URL | Type | Status |
|-----------|---------|------|--------|
| `/aviso-legal` | `/legal` | 308? | Not confirmed |
| `/envios-y-formas-de-pago` | `/shipping` | 308? | Legacy page 404 |
| `/donde-estamos` | `/contact` | 308? | Fragment of /contact |

---

## OpenCart Route Patterns (from robots.txt)

```
Disallow: /*?sort
Disallow: /*&sort
Disallow: /*?limit
Disallow: /*&limit
Disallow: /*?route=checkout
Disallow: /*?route=account
Disallow: /*?route=product/search
Disallow: /*&keyword
```

These patterns should return 410 Gone (OpenCart internals, not migrated).

---

## Implementation

In Next.js, redirects are configured in `next.config.ts`:

```typescript
// frontend/next.config.ts
{
  async redirects() {
    return [
      // Products
      { source: '/:slug', has: [{ type: 'query', key: 'route', value: 'product/product' }], destination: '/products/:slug', permanent: true },

      // Categories
      { source: '/:slug', has: [{ type: 'query', key: 'route', value: 'product/category' }], destination: '/categories/:slug', permanent: true },

      // Static pages
      { source: '/quienes-somos', destination: '/about', permanent: true },
      { source: '/contacto', destination: '/contact', permanent: true },
      { source: '/terminos-y-condiciones', destination: '/terms', permanent: true },
      { source: '/politica-de-cookies', destination: '/cookies', permanent: true },
      { source: '/politica-de-privacidad', destination: '/privacy', permanent: true },

      // Block OpenCart internals
      { source: '/admin/:path*', destination: '/404', permanent: false },
    ];
  }
}
```

---

## SEO Equity Notes

- 308 (Permanent Redirect) preserves most SEO equity
- All redirects must be in place before legacy site goes offline
- Submit updated sitemap to Google Search Console after migration
- Monitor 404 errors in Search Console for 30 days post-migration
