Shorten and clean URL slugs for on-page SEO

Rewrite each page's URL slug to two or three lowercase, hyphen-separated words built around the primary keyword. Drop underscores, capital letters and dates or numbers that do not describe time-sensitive content. Cleaner slugs are easier to read in search results and restate the target keyword in the URL; apply the rule to new content and templates first.

mediumIn codeimpact effort @connorshowler

Why this matters

Fix slugs with underscores, capitals, dates or four-plus words so each URL carries the target keyword.

Get the full breakdown

The extended brief explains when this works, when it does not, and the trade-offs. Join the waitlist and it unlocks for every tip when sign-in opens; MCP access is the paid part.

Join the waitlist

Before you start

  • Access to the CMS or code that sets page URLs
  • Ability to add 301 redirects on the server or in the CMS

How to apply it

  1. Flag slugs that break the rules

    Export URLs from Search Console or a crawler and look for slugs containing underscores, uppercase letters, four or more words, or embedded dates and numbers that are not part of the topic.

    Check: The exported URL list is filtered to a set of slugs containing at least one underscore, capital letter or date segment.

  2. Rewrite the slug to two or three words

    Build the new slug from the primary keyword plus at most two supporting words, lowercase only, separated by single hyphens, with dates and arbitrary numbers removed unless the content is date-specific.

    Check: The new slug matches the pattern ^[a-z0-9]+(-[a-z0-9]+)*$ and contains no underscore or uppercase character.

  3. Set the slug before publishing new pages

    For new content, set the slug in the CMS URL field before the first publish so no redirect is ever needed, and apply the same rule in page templates and programmatic URL generators.

    Check: The preview or draft URL in the browser address bar shows the clean lowercase hyphenated slug.

  4. Redirect changed URLs General best practice

    When an existing live slug changes, add a single 301 redirect from the old path to the new one and keep the old URL out of the sitemap.

    Check: curl -I your production domain/old-slug/ returns HTTP/1.1 301 with a Location header pointing at the new slug.

  5. Update internal links and the sitemap General best practice

    Replace internal links that point at the old slug and regenerate the sitemap so it lists only the new URL.

    Check: The regenerated sitemap.xml contains the new slug and no occurrence of the old slug; a site: search for the old path returns no internal pages linking to it.

Get the prompt for your agent

A ready-to-paste prompt for your agent that implements this tip and verifies the result in your repo.

Join the waitlist

Source: @connorshowler on 2026-10-18 · original post · report an error

Let your agent apply this + 161 more tips.

Pre-order — $19