Prev | Current Page 288 | Next

Emilian Balanescu and Cristian Darie

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


CHAPTER 7 ?–  SEARCH ENGINE OPTIMIZATION 193
Figure 7-2. Testing keyword-rich URLs
How It Works: Supporting Keyword-Rich URLs
At this moment, you can test all kinds of keyword-rich URLs that are currently known by your web site: department
pages and subpages, category pages and subpages, the front page and its subpages, and product details links.
Note, however, that the links currently generated by your web site are still old, dynamic URLs. Updating the links in
your site will be the subject of the next exercise.
The core of the functionality you??™ve just implemented lies in the .htaccess file.We??™ve used this Apache folderbased
configuration file to store the rewriting rules for mod_rewrite. The httpd.conf Apache configuration file
can also be used, but we??™ve chosen .htaccess because many web hosting scenarios will not allow you to modify
the httpd.conf file. Also, modifying .htaccess doesn??™t require you to restart the web server for the new settings
to take effect, because the file is parsed on every request, which makes it ideal for development purposes.
The first command in .htaccess is the one that enables the rewriting engine. If you didn??™t configure mod_rewrite
correctly, this line will cause an error:
RewriteEngine On
Next, we used the RewriteBase command to specify the name of the tshirtshop folder. Note that if you keep
your application in the root folder, you should replace /tshirtshop with /.


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