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.
I think the only useful option is to use a cookie.
When a URL with the wrong slug is requested, set a cookie for that URL without the slug:
$path = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/')+1);
setcookie('wrong-slug', 1, 0, $path);
Then test if such a cookie exists and display your message:
if (isset($_COOKIE['wrong-slug'])) {
echo 'The location of this resource has changed. Please update your bookmarks.';
}