Simple way to get CakePHP to allow direct access to files and directories.
The CakePHP framework as you know rewrites the browser URL to a friendly CakePHP implemented URL. This friendly URL reflects the policies that CakePHP follows which is the Model, View, and Controller (MVC). Briefly summarizing the MVC-URL correlation; Cake's input for a url is:
http://www.yoururl.com/model/action
Now to get out of this incapsulation for direct access to a download directory we must put icing on the Cake. This requires modifying .htaccess in the main directory where you extracted CakePHP. I used the linux command 'pico .htaccess' to open up an editor. The current .htaccess file should look similar or exactly like this:
# Begin CakePHP
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
And for the icing the updated .htaccess file should look like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/downloads/(.*)$
RewriteRule ^.*$ - [L]
</IfModule>
# Begin CakePHP
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Thats all! Having put the new mod_rewrite block above the current CakePHP code block allows for overiding specific cases. You can change the directory in the example from downloads to any other directory you want to overide and allow direct access to files.