I am new to databases and learning how to make db driven sites. I am already familiar with SEO but not when using a database. Let's say I want the structure of my site to be: mysite.com/products/1/ mysite.com/products/2/ mysite.com/products/3/ where 1,2 and 3 are the fields 'id' from my database (and each page will use content such as title, h1, description from the row in the database based on 'id') What is the best way to create this? Should I use mod_rewrite? should I use a cache? Of course if I wanted, I already know how to make a site with database query links such as: mysite.com/products.php?id=1 mysite.com/products.php?id=2 mysite.com/products.php?id=2 etc... Just trying to figure out a fairly simple way to make my site most SEO friendly.
You can do it by using mod_rewrite. Your rules would be very simple: RewriteEngine On RewriteBase / RewriteRule ^products/([0-9]+)/$ /products.php?id=$1 [L] Code (markup): Optionally you can add this line after the first rule: RewriteRule ^products/$ /products.php?id=1 [L] Code (markup): This is only in the case you wish your first page to be linked via mysite.com/products/ (without using products/1/ part here). It doesn't have any other function.