I have urls such as -> products.php?category=38 How would I rewrite these Urls to something like -> products/modern-lighting ("Modern Lighting" would be the category name which comes from the database table for category 38) I understand how to do basic url rewriting with the htaccess, but I'm stumped on how to turn that number '38' into its category name. Does anyone have an idea?
in your php page which links to products.php?category=38 add via a mysql query to extract title of the category with id 38 something like products.php?category=38&catname=modern-lighting then rewrite with mod_rewrite
You will need to have a programmer look into the code and tweak it. Also, you have not mentioned anything about what software you are using? Are you use some custom-made software or some openly available software such as Zencart, OsCommerce, etc? Did you check the settings section of the software to see if there is an option for such links?
Thanks, crivion, I did exactly what you mentioned then tweaked it a bit. That method works great. Problem solved. Thanks.
Just a note, if your category name is not the primary key, you will need to index it to avoid overheads in your table.