2008年9月30日星期二

[fw-mvc] OT - Rewrite rule for Zend

I'm trying to understand that Apache re-write rules, necessary to support
Zend ('cause I want to make changes to support having some URL paths that
are static and so should not get sent into Zend)

The recommended re-write setup is:

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

The first line is self explanatory.

The next three lines (the RewriteCond ones) detail the things we're going to
re-write (files, links & directories) Fine, got no problems here.

The final line says re-write to index.php (and hence force everything
through the front controller. I can handle this.

I have two problems/questions:

1) The penultimate line:

RewriteRule ^.*$ - [NC,L]

In a previous message (
http://www.nabble.com/Re%3A--fw-general--Using-the-Dojo-shipped-with-ZF-1.6.
0---Important-Note-p19422433.html) Matthew says that it means use the
original path.

But we're in .htaccess, so the original path is implicitly used unless
explicitly overridden. From
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

"However, in per-directory configuration files, the per-directory prefix
(which always is the same for a specific directory) is automatically removed
for the pattern matching and automatically added after the substitution has
been done"

2) We're in .htaccess, so we'd catch access to things like /view.html, etc
But surely it wouldn't catch /controller/action, would it ?

Thanks,

GTG

没有评论: