Here we will show some code and some URLs that will invoke our mod_rewrite rules:

Jaimie Sirovich , [ www.seoegghead.com ]

The following code demonstrates some of the functions we use:

<?php
require_once('mod_rewrite.inc.php');

echo 'This is _clean_url_text("carpenter\'s tools"):<br>';
echo _clean_url_text("carpenter's tools"); // == 'carpenters-tools'
echo '<br><br>';
echo 'This is _clean_url_text("black and white"):<br>';
echo _clean_url_text('black and white'); // == 'black-and-white'
echo "<br><br>";

echo 'This is make_product_url("carpenter\'s tools", 1, "belt sander", 2):<br>';
echo make_product_url("carpenter's tools", 1, 'belt sander', 2);
// == '/Products/carpenters-tools-1/belt-sander-2.html'

echo "<br><br>";
echo 'This is make_product_url("hammers", 3, "big and mighty hammer", 4):<br>';
echo make_product_url('hammers', 3, 'big and mighty hammer', 4);
// == '/Products/hammers-3/big-and-mighty-hammer-4.html'

echo "<br><br>";
?>

Now we execute it:

This is _clean_url_text("carpenter's tools"):
carpenters-tools

This is _clean_url_text("black and white"):
black-and-white

This is make_product_url("carpenter's tools", 1, "belt sander", 2):
/Products/carpenters-tools-1/belt-sander-2.html

This is make_product_url("hammers", 3, "big and mighty hammer", 4):
/Products/hammers-3/big-and-mighty-hammer-4.html

These two links are functionally the same; click to see it in action:
/products.php?category_id=1&product_id=2
/Products/carpenters-tools-1/belt-sander-2.html

Click here for the source code to .htaccess
Click here for the source code to mod_rewrite.inc.php
Click here for the source code to this page (index.php)
Click here for the source code to the rewritten products page (products.php)

More Information on the importance of URLs:

http://www.seoegghead.com/blog/seo/keywords-in-urls-revisited-p85.html

Example sites that use mod_rewrite:

www.lawyerseek.com

Matt Cutts of Google Inc. Speaks about mod_rewrite:

http://video.google.com/videoplay?docid=-6860320126300142609