JavaScript Editor Ajax software     Free javascripts 



Main Page

// retrieve product and category IDs from the query string
$product_id = $_GET[‘product_id’];
$category_id = $_GET[‘category_id’];
// retrieve product and category names from fictional database
$product_name = $GLOBALS[‘products’][$product_id];
$category_name = $GLOBALS[‘categories’][$category_id];
// create keyword-rich URL
$proper_url = make_category_product_url($category_name, $category_id,
$product_name, $product_id);
// redirect to keyword-rich URL if not already there
return $proper_url;
}
?>
3.
Add these lines to
product.php
:
<?php
// load library that handles redirects
require_once ‘include/url_redirect.inc.php’;
// redirect requests proper keyword-rich URLs when not already there
fix_category_product_url();
// display product details
echo ‘You have selected product #‘ . $_GET[‘product_id’] .
‘ from category #‘ . $_GET[‘category_id’];
?>
4.
Load
http://seophp.example.com/product.php?category_id=2&product_id=42
in
your web browser, and see some magic happen to the URL! Figure 4-4 shows how this request
was redirected to its keyword-rich (“proper”) version of the URL.
Figure 4-4
87
Chapter 4: Content Relocation and HTTP Status Codes
c04.qxd:c04 10:40 87


JavaScript Editor Ajax software     Free javascripts 
Bitcoin Gambling - The Original Crypto Dice Game . Site