Sub topic 10
Redirect old URLs with 301s
This chapter assumes you can read Search Console reports, edit server configuration, and already know which pages you are merging or removing. When two pages become one, the old URLs must send visitors and crawlers to the surviving page. A 301 redirect does this.
What a 301 does
A 301 is an HTTP status code meaning "moved permanently". The server answers a request for the old URL with the new address. Browsers follow it, and search engines treat the new URL as the replacement. Google generally passes ranking signals from the old URL to the new one, which is how consolidation keeps link equity.
A 302 means "found" or "temporary". Use it only when the old URL will return. For merged or removed pages, use 301.
Build the redirect map first
Before you edit any server file, write a table of old URL, new URL and reason. Each old URL should point to the most relevant surviving page, not to the home page.
| Old URL | New URL | Reason |
|---|---|---|
| /blog/seo-tips-2019/ | /guides/seo-checklist/ | Merged |
| /blog/on-page-seo-basics/ | /guides/seo-checklist/ | Merged |
Configure the redirects in nginx
For one page, use an exact-match location. For several pages, use a map. The map block belongs in the http context, and the if goes inside server.
# Redirect a single merged page
location = /blog/seo-tips-2019/ {
return 301 /guides/seo-checklist/;
}
# Redirect several merged pages with a map (declared in the http block)
map $uri $merged_target {
/blog/on-page-seo-basics/ /guides/seo-checklist/;
/blog/seo-tips-2019/ /guides/seo-checklist/;
}
server {
if ($merged_target) {
return 301 $merged_target;
}
}A map keeps the list in one place and is easy to review. When $uri has no match, $merged_target is empty, so the if does not fire.
Verify every redirect
Test with curl -I https://example.com/blog/seo-tips-2019/. Check three things:
- The status is
301, not302. - The
Locationheader is the intended page. - The final URL returns
200.
Then crawl the full list of old URLs and confirm each one behaves this way.
Common errors
- Redirect chains. A to B to C wastes crawl effort and can lose signals. Point every old URL straight at the final page, and update older redirects when a target moves again.
- Redirect loops. Two rules that send a URL back and forth cause errors. A crawl will expose them.
- Mass redirects to the home page. Search engines may treat these as soft 404s, where the page looks like an error even though it returns a success code. Redirect only to a closely matching page.
- Redirecting to a page that doesn't match. If the destination does not cover the old topic, the signals may not carry over.
- Leaving internal links on old URLs. Redirects are a safety net, not a replacement for updating links. The next chapters cover this.
- Removing the redirect too soon. Keep 301s in place for as long as the old URLs have backlinks or traffic, which usually means indefinitely.
Exercise
You merged /blog/old-guide/ into /guides/new-guide/ six months ago. Later, /guides/new-guide/ moved to /guides/complete-guide/. What should you change in your redirect rules, and why?
Show answer
Change the rule for /blog/old-guide/ so it points directly to /guides/complete-guide/, and add a rule for /guides/new-guide/ that does the same. This avoids a redirect chain (old-guide to new-guide to complete-guide), which wastes crawl effort and can weaken signal transfer.