December 3rd, 2011, 07:06 PM
Put the result of a SQL query into a .htaccess file?
I have just been trying to use mod_rewrite to create SEO friendly URLs. Very new to it.
In an eCommerce store the product urls are:
I want to use:
You see ^ the SEO friendly URL is a string/record from the database, it's the title field for the product with an ID of 1.
Can/how I use a SQL query inside the .htaccess file to make the writing of the .htaccess file automated? Or can you not do that, and my only option is to hardcode in the SEO friendly URLs by hand?
There are over 1000 products you see.
I'd appreciate any advice you can offer.
Thanks very much.
December 3rd, 2011, 08:32 PM
What you do is turn the friendly URL into the real URL using pattern matching.
Anything that looks like that gets rewritten to a different page. Say
Then products.php decides what to do from there according to $_GET["id"].
You aren't creating a rule for every single URL. Just the different forms of them.