top | item 41244653

(no title)

aejm | 1 year ago

What’s the best way to handle url slugs that change? For example, if I have www.example.com/page/foo, and the user changes that page’s title to bar, the slug updates to www.example.com/page/bar and anyone visiting the old url gets automatically redirected to the new one. But now the old slug of foo can’t be used again (without appending some unique identifier to it, like foo-th683gh9i).

discuss

order

isoprophlex|1 year ago

/page/:id/:slug-you-ignore, as in TFA. The id doesn't change, and the slug can be anything.

cthor|1 year ago

Rather than totally ignoring the slug, I prefer sending a 302 to the correct slug if the slug is absent or incorrect.