Ajax software
Free javascripts
↑
Main Page
2.
Add the following rewrite rule to the
.htaccess
file:
RewriteEngine On
# Rewrite numeric URLs
RewriteRule ^Products/C([0-9]*)/P([0-9]*)\.html$
i
/product.php?category_id=$1&product_id=$2 [L]
# Rewrite keyword-rich URLs
RewriteRule ^Products/.*-C([0-9]+)/.*-P([0-9]+)\.html$
i
/product.php?category_id=$1&product_id=$2 [L]
# Rewrite catalog.html
RewriteRule ^catalog.html$ /catalog.php [L]
# Rewrite cartoons.html
RewriteRule ^cartoons.html$ /cartoons.php [L]
# Rewrite media files
RewriteRule ^.*-M([0-9]+)\..*$ /media/$1 [L]
3.
Create a new file named
cartoons.php
in your
seophp
folder, and add the following code to it:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
<html>
<head>
<title>URL Rewriting Media Files</title>
</head>
<body>
<img src=”http://seophp.example.com/Tweety-M1.jpg” alt=”Tweety” />
<img src=”http://seophp.example.com/Toy-Story-M2.jpg” alt=”Toy Story” />
<img src=”http://seophp.example.com/Tweety-Sylvester-M3.jpg” alt=”Tweety &
i
Sylvester” />
<img src=”http://seophp.example.com/Mickey-M4.jpg” alt=”Mickey” />
<img src=”http://seophp.example.com/Minnie-M5.jpg” alt=”Minnie” />
</body>
</html>
4.
Load
http://seophp.example.com/cartoons.html
, and expect to see five images, as
shown in Figure 3-16.
Figure 3-16
73
Chapter 3: Provocative SE-Friendly URLs
c03.qxd:c03 10:39 73
Ajax software
Free javascripts
→ R7