JavaScript Editor Ajax software     Free javascripts 

Main Page

The URL rewriting service is provided by the Apache web server through the mod_rewrite module. PHP
does not have anything to do with it, because the PHP engine takes charge only once the
file is exe-
cuted. The mod_rewrite module is the de-facto standard for URL rewriting in the Apache world, and is
typically supported by any Apache-based hosting package. It is used in the examples in this chapter and
throughout this book.
Figure 3-3 describes how mod_rewrite fits into the picture. Its role is to rewrite the URL of the incoming
requests, but doesn’t affect the output of the PHP script in any way.
At first sight, the rewriting rules can be added easily to an existing web site, but in practice there are other
issues to take into consideration. For example, as shown a bit later, you’d also need to modify the existing
links within the web site content. In Chapter 4 you’ll continue by learning how to properly redirect old links
to the new links in a preexisting web site.
Figure 3-3
The mod_rewrite Apache module is an invaluable tool to web developers tasked with architecting
complex dynamic sites that are still search engine friendly. It allows the programmer to declare a set
of rules that are applied by Apache on-the-fly to map static URLs requested by the visitor to dynamic
query strings sent to various PHP scripts. As far as a search engine spider is concerned, the URLs are static.
Learning how to properly use mod_rewrite involves a lot of work, but the final
result is beautiful and elegant. It allows visitors and search engines to access your
site using aesthetically pleasing and search engine friendly static URLs. However,
in the background your PHP scripts still work with query string parameters, in the
typical parameter-driven fashion. As you can see in Figure 3-3, the PHP script is
unaware that the initial user request was for a different URL.
Internet Visitor
User requests
mod_rewrite translates the request to
product.php executes
and generates output
Apache Web Server
The Internet
Chapter 3: Provocative SE-Friendly URLs
c03.qxd:c03 10:39 47

JavaScript Editor Ajax software     Free javascripts 
Bitcoin Dice - Crypto Casino . paperhelp promotion code