Thanks for your suggestion Fernando.<br><br>Surely 'if (!-f $request_filename)' performs a stat check to see if the file exists - thereby increasing disk overhead?<br><br>Couldn't the regexp be reversed to exclude matching '.php'?<br>
<br>Does this make sense:<br><br>location ~ ^/(js|css|images|etc)/(.+)(?<!\.php)$ {<br> root /var/www/<a href="http://domain.com/public">domain.com/public</a>;<br> access_log off;<br> expires max;<br>
}<br><br>(I know that's almost certainly incorrect - but is that kind of regular expression possible?)<br><br>Thanks again<br><br><div class="gmail_quote">On Tue, Nov 11, 2008 at 10:35 AM, Fernando Perez <span dir="ltr"><<a href="mailto:lists@ruby-forum.com">lists@ruby-forum.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
> # DO NOT WANT TO USE THIS METHOD (WHICH WORKS):<br>
> #<br>
> # If the file exists as a static file serve it<br>
> # directly without running all<br>
> # the other rewite tests on it<br>
> #<br>
> # if (-f $request_filename) {<br>
> # break;<br>
> # }<br>
> # if (!-f $request_filename) {<br>
> # rewrite ^/(.+)$ /index.php?q=$1 last;<br>
> # break;<br>
> # }<br>
><br>
<br>
I am curious about why you don't want to use this method. What's wrong<br>
with it?<br>
<br>
For your regexp problem you can force the accepted extensions too:<br>
<br>
location ~ ^/(js|css|images|etc)/(.+)\.(png|gif|css|js)$ {<br>
root /var/www/<a href="http://domain.com/public" target="_blank">domain.com/public</a>;<br>
access_log off;<br>
expires max;<br>
}<br>
<br>
This way php files will not match the regexp and will not get served.<br>
<font color="#888888">--<br>
Posted via <a href="http://www.ruby-forum.com/" target="_blank">http://www.ruby-forum.com/</a>.<br>
<br>
</font></blockquote></div><br>