2009年7月16日星期四

Re: [fw-mvc] Router thinks mysite.com/js/my/customDojoClass.js is a valid controller - how to change?

Hi!

We use something like:

RewriteEngine On
RewriteRule favicon.ico public/favicon.ico [L]
RewriteRule robots.txt public/robots.txt [L]
RewriteRule !public index.php

This should be rewritten to index.php:
example.com/module/controller/action

Just keep your js, css and images in the /public directory tree, like so:
example.com/public/css/styles.css
example.com/public/images/background.png

Lauri


Nathan Garlington wrote:
>
> Thanks for the reply Matthew.  In my .htaccess:
>
> **************
> # .htaccess for mysite.org (/public_html/mysite)
>
> DirectoryIndex index.php
>
> 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 spite of the above rewrite declarations, I still get the previously
> mentioned exception.
> As you can see, this particular usage of ZF on a subdomain. Should I
> be setting the baseUrl in the front controller? And it's odd that the
> only time I get this particular error is when my login controller is
> being used. Doesn't seem to occur with any other controllers. But all
> the page requests access the same .htaccess so I'm not sure what the
> difference is, and most of my controllers/views use xhr or at least
> dojo in some way. Could there be something going on with my
> implementation that is causing this error? Just kinda throwing things
> out there because I really don't know what the problem is.
>
> --
> Regards,
> Nathan @ T&R Trailer Sales
>
> Tel: 719-546-2321
> Fax: 719-404-4697
>
>
> On Thu, Jul 16, 2009 at 8:53 AM, Matthew Weier O'Phinney
> <matthew@zend.com> wrote:
>>
>> -- Nathan Garlington <garlinto@gmail.com> wrote
>> (on Thursday, 16 July 2009, 08:42 AM -0600):
>> > (1.8.4) I was looking over my server error logs and noticed a number of
>> errors
>> > like the following:
>> >
>> > ***
>> > Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message
>> 'Invalid
>> > controller specified (js)' in
>> /home1/tandrtra/Zend/Controller/Dispatcher/
>> > Standard.php:241
>> > Stack trace:
>> > #0 /home1/tandrtra/Zend/Controller/Front.php(945):
>> > Zend_Controller_Dispatcher_Standard-&gt;dispatch(Object
>> > (Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
>> > #1 /home1/tandrtra/public_html/inv/index.php(47):
>> Zend_Controller_Front-&gt;
>> > dispatch()
>> > #2 {main}
>> > thrown in /home1/tandrtra/Zend/Controller/Dispatcher/Standard.php on
>> > line 241
>> > ***
>> >
>> > I was looking through the manual, but I'm not sure how to tell the
>> router that
>> > the route:
>> >
>> > example.com/js/*
>> >
>> > should be left alone. I'm sure this could probably be handled in the
>> rewrite
>> > definitions in .htaccess, but since the rewrite rules are fairly alien
>> to me,
>> > can I configure the router to accomplish this for me?
>>
>> Use the recommended rewrite rules from the manual. mod_rewrite is
>> determining where to send the request, and the recommended rules were
>> written precisely to ensure that public resources such as JS, CSS, etc.
>> in the document root are not served by ZF.
>>
>> --
>> Matthew Weier O'Phinney
>> Project Lead            | matthew@zend.com
>> Zend Framework          | http://framework.zend.com/
>
>

--
View this message in context: http://www.nabble.com/Router-thinks-mysite.com-js-my-customDojoClass.js-is-a-valid--controller---how-to-change--tp24517777p24520973.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: