Step Create Your htaccess File

The Zend Framework can work without mod_rewrite in Apache but it requires the manual configuration of the routes. For the purposes of this book, we will assume you are using Apache (see Chapter 1 for two packages that will install it for you if you like).

In the www directory, you will need a file named .htaccess. In it, place these two lines:

RewriteEngine on

RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php

The first one, of course, tells Apache to turn on mod_ rewrite for this directory and all of it's subdirectories. The second line tells mod_ rewrite that unless the requested URI is a resource (image, stylesheet, javascript, etc) to route it index.php. The FrontController will take it from there.

Was this article helpful?

0 0

Post a comment