JavaScript Editor Ajax software     Free javascripts 



Main Page

# Rewrite numeric URLs
RewriteRule ^Products/P([0-9]*)\.html$ /product.php?product_id=$1 [L]
2.
Switch back to your browser again, and this time load
http://seophp.example.com/
Products/P1.html
. If everything works as it should, you will get the output that’s shown
in Figure 3-7.
Figure 3-7
3.
You can check that the rule really works, even for IDs formed of more digits. Loading
http://seophp.example.com/Products/P123456.html
would give you the output
shown in Figure 3-8.
Figure 3-8
Congratulations! The exercise was quite short, but you’ve written your first regular expression! Take a
closer look at your new rewrite rule:
RewriteRule ^Products/P([0-9]*)\.html$ /product.php?product_id=$1 [L]
If this is your first exposure to regular expressions, it must look scary! Just take a deep breath and read
on: we promise, it’s not as complicated as it looks.
Appendix A contains a gentler introduction to regular expressions.
56
Chapter 3: Provocative SE-Friendly URLs
c03.qxd:c03 10:39 56


JavaScript Editor Ajax software     Free javascripts 
Bitcoin Dice Site . paperhelp org discount