Given that I know how to set the .htaccess…
So my user instead of
http://www.pets.com/products.php?id=7
will see
http://www.pets.com/products/7/
But how to manage urls with no id numbers like
http://www.pets.com/products/dog-food-purina
How can I write a general * rule to do that? Is it possible?
I thought I could write a php script that appends in the htaccess the rules one by one, one for each link, but it seems crazy right?
Something like
#RewriteRule ^dog-food-purina/$ product.php?id=1 [NC,L]
#RewriteRule ^dog-food-otherbrand/$ product.php?id=2 [NC,L]
...etc...
Why not make an additional unique identifier in your database, so that a row of data has both a unique ID (7) and a unique “slug” (dog-food-purina)? That way you can look up rows any way you want by simply forwarding either the slug or the ID to your PHP script and handling it all there.
And then do something like this:
Hope it helps