JavaScript Editor Ajax software     Free javascripts 

Main Page

the individual product pages. These URLs are “hackable,” in that the products will be placed in an
intuitive-looking directory structure. Users can intuitively modify such URLs to navigate the site.
Rewriting Keyword-Rich URLs
Modify the
file in your
folder like this:
RewriteEngine On
# Rewrite numeric URLs
RewriteRule ^Products/C([0-9]*)/P([0-9]*)\.html$
/product.php?category_id=$1&product_id=$2 [L]
# Rewrite keyword-rich URLs
RewriteRule ^Products/.*-C([0-9]+)/.*-P([0-9]+)\.html$
/product.php?category_id=$1&product_id=$2 [L]
, and
voila, you should get the result that’s shown in Figure 3-12.
Figure 3-12
You currently have two rules in your
file, and they are working beautifully!
The new rule matches URLs that start with the string
, then contain a number of zero or more
characters (
) followed by
. This is expressed by
. The next characters must be one
or more digits, which as a whole are saved to the
variable, because the expression is written between
parentheses —
. This first variable in the URL,
, is the category ID.
After the category ID, the URL must contain a slash, then zero or more characters (
), then
, as expressed
. Afterward, another captured group follows, to extract the ID of the product,
, which
becomes the
variable. The final bit of the regular expression,
, specifies the URL needs to end
The two extracted values,
, are used to create the new URL,
. Figure 3-13 describes the process visually.
Chapter 3: Provocative SE-Friendly URLs
c03.qxd:c03 10:39 65

JavaScript Editor Ajax software     Free javascripts 
Bitcoin Dice - Crypto Casino