first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Zend Framework: Apache .htacess Rule Alternatives; “Configuring Your URL Rewriter”

Although there is a performance hit, the preference here is to use .htaccess files for bootstrapping the Zend Framework. The 2006-era expression for using .htaccess comes from “Configuring Your URL Rewriter” here:

http://framework.zend.com/wiki/display/ZFDEV/Configuring+Your+URL+Rewriter

The Apache RewriteRule is:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\\.(js|ico|txt|gif|jpg|png|css)$ index.php

Here is a more recent expression:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

There may be one advantage here with the omission of RewriteBase. For more information, see “What happens to the Zend Framework routing tables when you change the site to a subfolder?” here:

http://stackoverflow.com/questions/1071003/
    what-happens-to-the-zend-framework-routing-tables
    -when-you-change-the-site-to-a-s
mod date: 2009-07-14T19:39:29.000Z