intermediate
Canonical URLs
Prevent duplicate indexing through canonical links, stable URL design, redirects, and consistent locale or filter URL policy.
Canonical URLs tell search engines which URL is the preferred version when duplicates exist—tracking params, HTTP/HTTPS, www variants, locale copies, or filter combinations. Use `<link rel="canonical" href="...">` or HTTP headers consistently with redirects and internal links.
<link rel="canonical" href="https://shop.example/products/shoes" />
| Duplicate source | Typical fix | |------------------|-------------| | `?sort=price` | Canonical to clean product URL | | `/en/...` vs `/...` | Policy + hreflang, not random canonicals | | Trailing slash mismatch | 301 + one canonical style | | Pagination | self-canonical or view-all policy |
Canonical is a hint—conflicting signals (canonical to A, sitemap lists B, redirects to C) weaken trust.
On interviews: canonical vs 301; parameterized URLs in ecommerce; faceted navigation; when not to canonicalize (print view).
Common pitfalls: canonical pointing to 404; cross-domain canonical without ownership; every filter page canonical to homepage; ignoring internal links still pointing at duplicates.
The trade-off is preserving marketing URLs versus consolidating ranking signals.
Checklist:
- One preferred URL per content entity.
- Align canonical, redirects, and internal links.
- Document locale and filter URL policy.
- Audit Search Console duplicate reports.