I am interested in making my website URLs friendlier for the eye (and Google) by implementing various directories rather than obscure ?id=xyz pages. Examples:
/review.php?id=371
To
/review/deja-vu/
And
/reviews.php?sort_by=1&order=1&approved=1
To
/reviews/asc/by_title/approved/
And so on..
However, when googling the subject, it seems that there are a lot of hints, tips and optimal practice suggestions available on the internet, but very little in actual guides or tutorials on how this is done fundamentally. Bits and pieces I managed to pick up imply that .htaccess and HTTP redirects are key, however...
I can't do a simple replacement since the article name isn't actually in the URL (an ID must somehow become the title string assigned to the article)
I need my site to link to the 'prettified' URLs, so I also need a PHP/MySQL component to the system (unless .htaccess code magically replaces all existing links on pages with pretty versions?)
Thus my question: How are friendly URLs done? My site uses PHP and calls its content from a MySQL database. Should I add a new MySQL table with two columns to translate specified URLs into shiny new ones, as in:
Column 1: review.php?id=371 Column 2: review/deja-vu/
then replace all 'raw' hyperlinks on the pages with PHP using these values and use .htaccess magic to redirect? Maybe there's a better, more practical approach? Or maybe I'm entirely on the wrong track here?