Hi Everyone, I have a question regarding rewriting URLS in php while using data from your MySql database. Let's say for example I want to use certain keyword(s) from my database in my meta tags and URLS how would I go about doing that writing that in .htaccess? Would I have to create variables for certain keywords in my MySql database? For example, $product, $location etc .... and then place the above variables in my meta tags and URLS? and then reconfigure my .htaccess? Thanks for everyones help!
Your example is terribly vague and doesn't paint a clear picture at all. In fact, this question is hard to follow. So I'm going to just GUESS at what you are trying to ask. Generally you rewrite URLS BEFORE you access any information in a database. Then you can use the values rewritten in the htaccess to display info from your database. If you wanted to rewrite blah.etc/products.php?location=new-jersey&product=sony-cameras to something cleaner like blah.etc/products/new-jersey/sony-cameras you could use: RewriteEngine on RewriteRule products/(.*)/(.*)$ products.php?location=$1&product=$2 [NC,L] then in products.php you could use $_GET["location"] and $_GET["product"] to access the data in the URL to use to look up whatever content in the database. * Any code posted has not been tested. May contain an error but nothing that can't be easily resolved or spotted.