What does the "-" exactly mean in this rule? I know what it does now, but I have never seen it before.
    RewriteRule ^.*$ - [NC,L]
I cannot find any documentation for it. Can you point me to it.

Christoph



Matthew Weier O'Phinney wrote:
Greets --

A number of users have reported issues using the Dojo package shipped
with 1.6.0. Originally, my thought was that we had a dirty install.
However, a couple of comments tipped me off to the real culprit: the
RewriteRule recommended in our Zend_Controller QuickStart and the one
recommended in the QuickStart guide.

First, some background.

The "recommended" RewriteRules look like the following:

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

This rule essentially says, "unless you're an image, CSS file, or
_javascript_ file, I'm going to route you to the front controller."

Many of Dojo's dijits utilize templates when creating widgets, and the
content is then inserted to the DOM.  In a release or custom build of
Dojo, all templates are interred into the source -- meaning that they
are embedded in the _javascript_. In a source build, however, these
templates are in separate files -- HTML files. If you look carefully at
the RewriteRule above, HTML files are not part of it. What this means is
that when a request is made to such a file, it's processed incorrectly,
and the dijit is not able to build its DOM nodes correctly -- which
leads to the errors users were reporting.

Fortunately, there is a solution: a better rewrite rule. The one
presented below has been circulating around in a variety of places, and
was in fact the reason I never saw the reported issues myself. Instead
of relying on the file extension to determine whether or not to rewrite,
it relies on file presence:

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

In essence, what this rule is saying is, "if the requested resource is
not a valid symbolic link, file, or directory, rewrite to the front
controller; otherwise, serve it." This rewrite rule solves the problem
of being unable to grab the source templates, thus allowing the shipped
Dojo to work correctly. It will also jcontinue to work when you create a
custom build.

I will be updating the Zend_Controller documentation, and also the
QuickStart, to reflect this.

  


Reply via email to