I\'m implementing a slug system for my website at the moment. I plan to redirect invalid slugs to the correct on that is stored in the database. E.g.
Found a working solution:
Start session.
Check session, if $_SESSION['INVALID_SLUG'] exists display message then unset session
else
Retreive slug from database e.g. /11/right-slug
Get current URI e.g. /11/wrong-slug
Compare, if different set $_SESSION['INVALID_SLUG'] and redirect to correct page
Any feedback? I realise this will not detect a 301 redirect itself more detect a trigger assosiated with the redirect.
Thanks for all the help.