2011年1月20日星期四

Re: [fw-mvc] Re: CSS Issue

Hey!

The problem seems to be an issue with uri-rewriting of our favourite
native american, Apache. :)

He matches a standard RewriteRoule of your .htaccess, let's say
RewriteRule ^.*$ /index.php [NC,L]
to the requests. So let's say you give the uri to your image foobar.png
/media/images/foobar.png
the client, i.e. your browser, who wants to fetch all other files like
.css, .js or .png, now gets the uri
<yourdomain>/index.php
which is, of course not right, cause your images are in
<yourdomain>/media/images/

So, just put a line like that into your .htaccess file ABOVE the
standard RewriteRule
RewriteRule media/(.*)\.(css|jpe?g|gif|png)$ - [L,T=image/*]
which advises the apache to NOT OVERWRITE the uri to
<yourdomain>/index.php
but to let it just as it is. The general form of RewriteRules is kinda like that
RewriteRule <regex-pattern-to-be-matched> <overwriting-uri>
[<one-or-more-flags>]

Consider reading some documentation about the uri rewriting [1] or the
apache docs [2]. The flag L stands for LAST (last matched rule, i.e.
stop matching request against rules) and T for TYPE (image, you
see..). The flag NC above stands for "NO CASE" which results in
case-insensitive pattern-matching.

Hope that helps you a little bit!

Ciao Nico

[1] http://www.widexl.com/tutorials/mod_rewrite.html
[2] http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html


On Thu, Jan 20, 2011 at 3:30 PM, harish <harish.20007@gmail.com> wrote:
>
> Hello David,
>
> I'm new to Zend, and thanks a lot for the the solution regarding "forward"
> issue, i was struggling with this all day.
>
> CSS Issue -
>
> I'm processing a request on Index page and after the request is successful
> i'm redirecting it back to Index page.
>
> First time when I open Index page everything works fine but after
> redirecting it back to Index page the CSS and the images do not appear.
>
> I just wanted to let you know I'm not using any layouts, I've just put all
> of my pages separately in the "views" section with respective actions.
>
> I really appreciate your help.
>
> Thanks,
>
> Harish
>
> --
> View this message in context: http://zend-framework-community.634137.n4.nabble.com/CSS-Issue-tp3225491p3225517.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
>

没有评论: