The following rule rewrites categories with pages, and the regular expression is highlighted:
# Redirect category pages
RewriteRule ^.*-d([0-9]+)/.*-c([0-9]+)/page-([0-9]+)/?$
index.php?DepartmentId=$1&CategoryId=$2&Page=$3 [L]
This regular expression is intended to match URLs such as http://localhost/tshirtshop/
regional-d1/french-c1/page-2 and extract the ID of the department, the ID of the category,
and the page number from these URLs. In plain English, the rule searches for strings that start
with some characters followed by -d and a number (which is the department ID), followed by
a forward slash, some other characters, -c and another number (which is the category ID), followed
by /page- and a number, which is the page number.
Using Table 7-2 as a reference, let??™s analyze the regular expression technically. The expression
starts with the ^ character, matching the beginning of the requested URL (the URL doesn??™t
include the domain name). The characters .* match any string of zero or more characters,
because the dot means any character, and the asterisk means that the preceding character or
expression (which is the dot) can be repeated zero or more times.
The next characters, -d([0-9]+), extract the ID of the department. The [0-9] bit matches
any character between 0 and 9 (that is, any digit), and the + that follows indicates that the pattern
can repeat one or more times, so you can have a multidigit number rather than just a single
digit.
Pages:
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306