AlexBrand
AlexBrand

Reputation: 12399

Route to page in webroot folder? - CakePHP

How can I define a route to a .php file in my webroot folder?

Thank you

Edit:

How can I render a file in the webroot folder from a controller? I need this because I am using Auth.

Upvotes: 1

Views: 2230

Answers (1)

deceze
deceze

Reputation: 522125

I'm guessing you're trying to password/Auth protect a file in the webroot folder. If so, you're on the wrong track. Files in the webroot are served as-is by default and are bypassing Cake entirely. Any file you put in the webroot is by definition "public". To protect it, you'll need to store it someplace else outside the webroot. You can then serve this file from a controller using the Media View. Your URL would look like, for example, /files/download/foo, which maps to FilesController::download('foo') via normal routes.

Upvotes: 2

Related Questions