Quick way to prevent your Zend Controller from handling a Folder Tips, Tricks and Tutorials 30 JUN 2014

If you have a folder which you need to access in the standard way without your Zend Controller handling it for you (maybe a direct file download outside of your Zend web application), the easiest and quickest way to do this is to simply create a .htaccess file inside the folder you want your Zend controller to ignore and populate it with:

RewriteEngine Off

Because .htaccess files work in a cascading manner, this will overwrite the Zend controller .htaccess file in the root folder, in essence turning off mod_rewrite and thus giving you full control over the folder in terms of Apache now serving it as how it normally would.

zend-zf-logoQuick and easy.

(There are of course loads of other ways to do this, like implementing something like “RewriteRule ^(admin|user)($|/) – [L]” – if you want to ignore folders admin or user – at the top of your main Zend .htaccess file in root, but I like the above as a particularly quick and easy way to simply ignore a specific directory!)

Related Posts:

About Craig Lotter

Software developer, husband and dad to two little girls. Writer behind An Exploring South African. I don’t have time for myself any more.