I think I can answer my own question now (which was pretty easy, once
I "got it").    You have to construct the links to the files
explicitly:  ie, html->link("click here","http://www.mydomain.com/
files/example.pdf").   Or, on a system without mod_rewrite, the link
would be to:  http://mydomain.com/app/webroot/files/example.pdf";

I had been trying to build the link like this:
html->link("click here","/files/example.pdf")

bit the link Cake constructs does not link to the file ... it tries to
link to a "files" controller", leading to the error I was getting (and
on my system without mod_write it includes index.php in the url, which
again leads to a problem).

That's my theory at least.  Link to the files directly, and you're OK.

-Greg Kramer



On Apr 8, 10:50 pm, G Kramer <[EMAIL PROTECTED]> wrote:
> Perfect.  I got it now.  It works as you indicated with no missing
> controller error.
>
> Side question, how would you get this to work if you weren't using
> mod_rewrite (anything in the routes.php that you could configure for
> that?).   Mostly just curious...
>
> Thanks,
> G Kramer
>
> On Apr 7, 5:24 am, "Steven M. Parker" <[EMAIL PROTECTED]> wrote:
>
> > The answer to this is that the mod_rewrite (.htaccess) files are
> > already setup to handle this. If you access a file hosted in /app/
> > webroot/files/example.pdf from the URLwww.example.com/files/example.pdf,
> > it will redirect you to example.com/app/webroot/files/example.pdf. If
> > however the file doesn't exist, then cake will try to parse it as a
> > request for a controller.
>
> > Notice the couple of lines in app/webroot/.htaccess saying "!-f" and
> > "!-d"? That's a test to see if the request is already a file, or a
> > directory...and if so, just let the request pass through. Otherwise,
> > redirect to cake's controller processing.
>
> > Steven
>
> > On Apr 5, 10:08 am, G Kramer <[EMAIL PROTECTED]> wrote:
>
> > > I'm sorry, I have a similar issue and don't quite follow this
> > > response.   This says I don't need to change the routes/rewrite rules
> > > but yet I still will get an error ... aren't we talking about how to
> > > get rid of the error?
>
> > > Thanks,
> > > Greg K
>
> > > On Mar 28, 11:51 am, Sliv <[EMAIL PROTECTED]> wrote:
>
> > > > files is a special folder that should work for direct links to files
> > > > within it, without needing to modify routes/rewrite from a default
> > > > install, but you will get a filescontroller error for a bad link

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to