JavaScript Editor Ajax software     Free javascripts 



Main Page

Figure 3-4
As you know, what mod_rewrite basically does is to translate an input string (the URL typed by your
visitor) to another string (a URL that can be processed by your PHP scripts). In this exercise you make it
rewrite
my-super-product.html
to
product.php?product_id=123
.
This exercise, as all the other exercises in this book, assumes that you’ve installed
Apache and PHP as shown in Chapter 1.
Please visit Jaimie Sirovich’s web page dedicated to this book —
http://www
.seoegghead.com/seo-with-php-updates.html
— for updates and additional
information regarding the following code.
httpd.conf versus .htaccess
There are also some subtle differences in the way Apache handles rules for mod_rewrite
in
.htaccess
vs.
httpd.conf
. If for any reason you prefer using
httpd.conf
, you’ll
need to take this into consideration while going through the exercises:
1.
You should place your rewrite rules inside the
<VirtualHost>
element of
the
httpd.conf
or
vhosts.conf
file instead of
.htaccess
.
2.
When working with
htppd.conf
, the slash (
/
) that follows the domain
name in a URL is considered to be part of the URL.
In the next exercise, you are presented this URL rewriting code:
RewriteEngine On
RewriteRule ^my-super-product\.html$ /product.php?product_id=123
When using
httpd.conf
, the rule would need to contain an extra slash:
RewriteEngine On
RewriteRule ^
/
my-super-product\.html$ /product.php?product_id=123
50
Chapter 3: Provocative SE-Friendly URLs
c03.qxd:c03 10:39 50


JavaScript Editor Ajax software     Free javascripts 
Bitcoin Dice - Crypto Casino