# Keep your rankings when you relaunch

> Map every old URL to its new page with 301 redirects in netlify.toml, test them, and monitor Google after launch so you keep your traffic.

Source: https://viralistic.nl/help/astro/redirects

A relaunch is the moment many websites lose years of search traffic. Old addresses stop working, Google finds error pages instead of content, and links from other sites lead nowhere. This article is for anyone moving to a new Viralistic Astro site from WordPress, Webflow or an older version. You will learn how to list your old URLs, redirect each one to the right new page and check the result after launch.

## Why redirects matter

A 301 redirect tells browsers and search engines that a page has moved permanently. Visitors land on the new page, and search engines transfer most of the old page's ranking signals to the new address. Without a redirect, the old URL returns a 404 error, and over time it drops out of search results.

## List every old URL

Do this before the old site goes offline.

1. Download the old site's sitemap, usually at `/sitemap.xml`.
2. In Google Search Console, export the pages that received clicks over the longest period available.
3. Export pages with links from other websites, from the Links report in Search Console or an SEO tool.
4. Crawl the old site with a website crawler to catch pages missing from the sitemap.
5. Combine everything in one spreadsheet with three columns: old URL, new URL and status.

> **Tip:** Do not forget PDFs, images that other sites link to, and old campaign landing pages. They often have more backlinks than you expect.

## Map old pages to new pages

- Map each old URL to the most relevant new page. A blog post goes to the same post, a service to the matching service.
- If there is no direct equivalent, choose the closest parent page, such as the overview of all cases.
- Do not send everything to the home page. Search engines treat that as a missing page anyway.
- Use one wildcard rule for a whole group of old URLs when they all go to the same place.

## Add redirects in netlify.toml

Viralistic sites keep all redirects in `netlify.toml` at the root of the project, so they are real server redirects and live in one place.

```toml
# One old page to one new page
[[redirects]]
  from = "/about-us"
  to = "/about"
  status = 301

# A specific old project first
[[redirects]]
  from = "/wf-projects/silverdrive"
  to = "/cases/silverdrive"
  status = 301

# Then everything else in that old folder
[[redirects]]
  from = "/wf-projects/*"
  to = "/cases"
  status = 301
```

Two Netlify rules to remember:

- **Order matters.** Netlify uses the first rule that matches, so put specific rules above wildcard rules.
- **Existing files win by default.** If a page still exists at the old address, the redirect is ignored. Add `force = true` to a rule when it must always apply, as with redirecting `www` to your main domain.

```toml
[[redirects]]
  from = "https://www.example.com/*"
  to = "https://example.com/:splat"
  status = 301
  force = true
```

The `:splat` part carries over whatever matched the `*`, so `www.example.com/contact` goes to `example.com/contact`.

## Test before you launch

1. Open the deploy preview of the new site and try a handful of old paths from your spreadsheet.
2. After launch, check the response of any old URL from a terminal:

```bash
curl -I https://example.com/about-us
```

3. Look for a `301` status and a `location` header with the new address.
4. Make sure there are no chains (old to older to new) and no loops.
5. Update links inside the new site so they point straight to the new URLs instead of relying on redirects.

## After launch

1. Submit the new sitemap in Google Search Console.
2. Check the indexing report weekly for the first month. Add redirects for any old URL that shows up as not found.
3. If your domain changed, keep the old domain connected to Netlify so its redirects keep working, and use the change of address tool in Search Console.
4. Keep redirects for at least a year. In practice, leave them in place: they cost nothing.

> **Note:** Some movement in rankings during the first weeks after a relaunch is normal while Google processes the changes. A steady decline after a month means something is missing, usually redirects.

If you are planning a relaunch and want the migration handled for you, book a strategic call: https://calendly.com/marrallisa/30min

## Next steps

- [Make your Astro site rank well](https://viralistic.nl/help/astro/astro-seo)
- [Connect your domain](https://viralistic.nl/help/astro/connect-your-domain)
- [Deploy to Netlify](https://viralistic.nl/help/astro/deploy-to-netlify)
