I have built a PHP-MYSQL website that retrieves products from a database. The items are taken by id in the URL like this: index.php?id=25
.
However, I just read that this is not the best option for SEO purposes.
Is there any simple way to have the item name and category populated in the URL instead of the id number? Or should I call each item using the field NAME and CATEGORY from the database?
Thanks!
When you print
the link add some detail to it (that your index.php
will not use anyway).
So your links will look like: index.php?id=25&c=Airplanes&q=Fighter+Jet+Z672
index.php
will function as before via id
and ignore &c=
and &q=
.
To make this even better you'll use a .htaccess file to rewrite your links to something like: mysite.com/Airplanes/25-Fighter-Jet-Z672