We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon and assets, static files

Hey guys!

When I was reading answers on this forum I often met with advices from Phalcon team to put favicon or robots.txt to public root folder to prevent wrong dispatcher exception events.

So here the problem starts: does Phalcon handles any request even to static files called «assets»?

Calm me down please and say I’m wrong :)

And another one question: does assets manager caches files after minification or not? Docs doesn’t say anything about that. I guess it’s unnecessary to minify unchanged files every page load.



34.6k
Accepted
answer
edited May '15

If a file is requested and it does not exist in the public document root the web server falls back to the application, so any css/js/img/favicon/robots.txt that does not exist will be handled by the application.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d # if the requested file is not directory
    RewriteCond %{REQUEST_FILENAME} !-f  # if the requested file is not a regular file
    RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L] # serve the request using PHP
</IfModule>

OK, thanks!

And what about my second question: Does assets manager caches files after minification or not? Docs doesn’t say anything about that. I guess it’s unnecessary to minify unchanged files every page load.