Content URLs are long-lived interfaces. Search engines, external sites, bookmarks, and internal links may depend on them long after an editorial change.
Define one canonical URL per item
Choose a predictable URL structure and ensure every published item has one preferred address. Normalize trailing slashes, hostname variants, and protocol consistently. Canonical tags should point to the preferred URL, not to a temporary redirect or an unrelated page.
Treat slug changes as migrations
When an editor changes a slug, save the old path and create a permanent redirect to the new canonical URL. Prevent redirect loops and chains by resolving old paths directly to the current destination.
Validate redirect destinations and restrict them to approved local paths or explicitly trusted hosts. An unrestricted redirect field can become an open-redirect vulnerability.
Preserve useful behavior
Update internal links, sitemaps, feeds, and canonical metadata when routes change. Keep redirects for a reasonable long-term period, especially when external links may exist.
Implementation checklist
- Define canonical hostname and path normalization.
- Store old slugs and redirect destinations.
- Resolve redirects directly to the final URL.
- Validate destinations against open redirects.
- Update sitemaps and internal references.