Hi,
I am pretty sure every ZF developer wondered about the reason why there are
multiple requests made to the MVC when there was only one made by you. The
reason (that the ZF leaders are aware of) is because of the new Apache
rewrite rules.
The old rewrite rules were "If it's a resource file requested do not forward
it to the MVC even it's missing on the server"
The current rewrite rules are "if it's located on the file system then
server it!" meaning that even if a file is requested but is not present on
the server it will be forwarded to the ZF MVC. which i think is a bad idea.
That's the reason why so many developers wondered about the session being
unset too early, various logs about file missing, and multiple requests
made. So i was wondering why wouldn't we have a mix of the two?
I currently use the following rewrite rules:
# Env
SetEnv APPLICATION_ENV development
# PHP Values
php_value include_path "...."
php_value magic_quotes_gpc "off"
# Rewrite Engine
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} \.(js|ico|gif|jpg|png|css|pdf)$ [OR]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
notice the rewrite rules, what they do now is "if it's a resource
(js|ico|gif|jpg|png|css|pdf) do not forward it to the MVC other wise if the
resource exists on the file system server that resoruce if it doesn't exists
on the file system redirect to the MVC" which up until now served me very
well.
So my question is why wouldn't ZF adapt those rules instead of the current
ones and save all those repeating questions regarding multiple requests
made?
And of course to share this with the rest.
Thanks.
--
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.
Zend Framework Certified Engineer.
-- http://www.vadimg.co.il/