Prev | Current Page 289 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


RewriteBase /tshirtshop
Then, the real fun begins. A number of RewriteRule commands follow, which basically describe what URLs should
be rewritten and to what they should be rewritten. Sometimes, the RewriteRule commands are accompanied by
CHAPTER 7 ?–  SEARCH ENGINE OPTIMIZATION 194
RewriteCond, which specifies a condition that must be met in order for the following RewriteRule command to
be executed.
A RewriteRule command contains at least two parameters. The first string that follows RewriteRule is
a regular expressionthat describes the structure of the matching incoming URLs. The second describes what
the URL should be rewritten to.
mod_rewrite and Regular Expressions
Regular expressions are one of those topics that programmers tend to either love or hate.
A regular expression, commonly referred to as regex, is a text string that uses a special format
to describe a text pattern. Regular expressions are used to define rules that match or transform
groups of strings, and they represent one of the most powerful text manipulation tools available
today. Find a few details about them at the Wikipedia page at http://en.wikipedia.org/
wiki/Regular_expression.
Regular expressions are particularly useful in circumstances when you need to manipulate
strings that don??™t have a well-defined format (as XML documents have, for example) and
cannot be parsed or modified using more specialized techniques.


Pages:
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301