I have a PHP website, that has content posted by the administrator, and content posted by loggedin users. I use a content slug in URLs. If a user changes his post the corresponding slug may changes and the consequently the URL. Whenever an old page is requested I need to redirect to the new one.
This is the method I'm thinking of implementing: create a mysql table containing old URLs and the corresponding new URLs and then whenever a logged in user changes their post, I will programmatically update that table. When requesting a non-existant page, I would first check that table to see if that link exists there to do a redirect 301 to the new URL. Otherwise i will return 404.
Would that be a good approach?