Bulk URL Slug Migration: Build a Safe Redirect Map
Generate slugs for a content migration, identify collisions, and preserve existing URLs with explicit redirects.

A slug migration changes the public address of content. Generating neat new strings is only one part of the job: every existing URL needs a deliberate destination, and each destination must remain unique. Start from a complete content export that includes stable record identifiers and current canonical URLs.
Generate candidates without losing row identity
Keep source ID, old URL, title, proposed slug, and final URL in one mapping table. Our batch generator creates one slug per input line in the same order and rejects duplicate outputs. Latin accents are normalized, punctuation becomes hyphens, and unsupported scripts may be removed. Review multilingual titles separately with a transliteration or native-script policy appropriate to the site.
Resolve collisions before publishing
Titles such as Red Shoes and Red-Shoes can produce the same slug. Use a meaningful qualifier, category, or stable identifier when collisions occur. Do not silently overwrite an existing route or rely on row order to choose the surviving page. Check proposed slugs against both the current live routes and other migration candidates, including reserved paths such as login or api.
Publish and verify the redirect map
Use permanent redirects from old URLs to their closest relevant replacements. Avoid sending every old page to the homepage, and avoid multi-step chains when a direct mapping is available. Update internal links and canonical tags to the final URLs, then regenerate the sitemap from real destinations. Test a representative set of old URLs and confirm that the target returns useful content rather than a soft error page.
Worked example
id | old_url | title | new_url
42 | /item/42 | Café Mug | /products/cafe-mugShould old slugs remain in the sitemap?
List canonical destination URLs in the sitemap. Keep old-to-new mappings in redirect configuration so existing links still work.


