JavaScript Editor Ajax software     Free javascripts 

Main Page

Unlike with mod_rewrite, when you supply a regular expression to a PHP function you need to enclose
the regular expression definition using a delimiter character. The delimiter character can be any character,
but if the same character needs to appear in the regular expression itself, it must be escaped using the
backslash (
) character. The examples here use
as the delimiter. So if your expression needs to express
a literal
, it should be indicated as
Rewriting Numeric URLs with Two Parameters
What you’ve accomplished in the previous exercise is rewriting numeric URLs with one parameter. You
now expand that little example to rewrite URLs with two parameters.
The URLs with one parameter that you supported looked like
. Now assume that your links need to support a category ID as well, not only a
product ID. The new URLs will look like this:
The existing
script will be modified to handle links such as:
For a quick reminder, here’s the rewriting rule you used for numeric URLs with one parameter:
RewriteRule ^Products/P([0-9]*)\.html$ /product.php?product_id=$1
PHP Function
Similar to
, but all matches are searched. After one match
is found, the subsequent searches are performed on the rest of the
string. More details at
Escapes all special regular expression characters of the input string
using the backslash character. More details at
The function replacing matching parts of a string with a replacement
expression. It receives three non-optional parameters: the pattern
used for matching, the replacement expression, and the input string.
More details at
Similar to
, except instead of a replacement expression,
you specify a function that returns the replacement expression. More
details at
Splits a string on the boundaries matched by a regular expression. The
resulting substrings are returned in the form of an array. More details
Chapter 3: Provocative SE-Friendly URLs
c03.qxd:c03 10:39 61

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