For human-readable URL slugs, prefer lowercase words separated by hyphens:
1 | /products/green-dress |
rather than:
1 | /products/green_dress |
Search engines generally interpret hyphens as word separators, and hyphenated slugs are easier for people to scan. This is a convention, not a magical ranking button.
Practical rules
- Use lowercase letters.
- Separate words with hyphens.
- Keep slugs short but descriptive.
- Avoid unstable details such as temporary status or presentation labels.
- Preserve old URLs with redirects when a slug changes.
- Do not put secrets or sensitive data in a URL; URLs leak into history, logs, analytics, and referrer headers.
A clean slug improves readability, but content quality, links, page performance, and stable redirects matter far more than winning a philosophical war between - and _.